芝麻web文件管理V1.00
编辑当前文件:/home/sditechnicalteam/socialsolargreens.pk/controller/customer_controller.php
con,$Customer); return $data; } public function Save($Customer) { if ($Customer['Type'] == "WalkIn") { $Customer_Referdby = "Self"; $Customer_Company = "Self"; } if ($Customer['Type'] == "Agent") { $Customer_Referdby = "Self"; $Customer_Company = $Customer['Company']; } if ($Customer['Type'] == "Reference") { $Customer_Referdby = $Customer['Referdby']; $Customer_Company = "Self"; } $account_no1=''; $ThirdLevel_AccountNo = $this->select_query("select IFNULL(MAX(AccountNo), 0) as account_no from ThirdLevel where Headid = '1'"); if ($ThirdLevel_AccountNo[0]['account_no'] == 0) { $account_no1 = "1100001"; } else { $account_no1 = $ThirdLevel_AccountNo[0]['account_no'] + 1; } $Customer_AccountNo = $account_no1; if ($Customer['AccountNo'] == 0) { $q = "Insert into ThirdLevel (AccountNo, Headid, SubHeadid, SecondHeadid, AccountTitle, AccountType, Dr, Cr) VALUES (".$account_no1. ",1,1001,1000002,N'".$Customer['Name']."','Customer',0,0)"; if (mysqli_query($this->con, $q)) { $q2 = "INSERT INTO customer (AccountNo,NAME,Phone,`Type`,Referdby,Company) VALUES ('".$Customer_AccountNo."','".$Customer['Name']."','".$Customer['Phone']."','".$Customer['Type']."','".$Customer_Referdby."','".$Customer_Company."')"; if (mysqli_query($this->con, $q2)) { return 'Success'; } else{ return "Error Code [321] : " . mysqli_error($this->con); } } else { return "Error Code [132]: " . mysqli_error($this->con); } } else { $q2 = "UPDATE customer SET NAME = '".$Customer['Name']."',Phone = '".$Customer['Phone']."',Type = '".$Customer['Type']."',Referdby = '".$Customer_Referdby."',Company = '".$Customer_Company."' WHERE Id = '".$Customer['Id']."'"; if (mysqli_query($this->con, $q2)) { // return json_encode($Customer); return 'Success'; } else{ return "Error Code [421] : " . mysqli_error($this->con); } } } public function Edit($AccountNo = ''){ if(!empty($AccountNo)){ $Customer = "select * from customer where AccountNo = $AccountNo"; $d = mysqli_query($this->con, $Customer); // print_r($d); if ($d->num_rows > 0) { $data = mysqli_fetch_assoc($d); return $data; } else{ return "Error Code [521] : " . mysqli_error($this->con); } } } public function Delete($AccountNo = ''){ global $dbobj; $Customer = "Delete from customer where AccountNo = $AccountNo"; if (mysqli_query($this->con, $Customer)) { return 'Customer Deleted Success'; } else{ return "Error Code [245] : " . mysqli_error($this->con); } } function XML_file() { // XmlDocument Doc = new XmlDocument(); // Doc.Load(string.Concat(host.WebRootPath, "/wwwroot/test.xml")); // foreach (XmlNode node in Doc.SelectNodes("/catalog/book")) // { // string b = node["author"].InnerText; // string c = node["title"].InnerText; // string d = node["price"].InnerText; // } // return View("Create"); } } ?>