Beispiel #1
0
Datei: Psp.cs Projekt: ubs121/psp
		public string SaveCustomer(Customer cus) {
			ValidatePermission("Customer");

			SqlConnection con = new SqlConnection(strCon);
			daCustomer.UpdateCommand.Connection = con;

			string msg = "";

			try {
				con.Open();

				daCustomer.UpdateCommand.Parameters["@isdn"].Value = cus.isdn;
				daCustomer.UpdateCommand.Parameters["@status"].Value = cus.status;
				daCustomer.UpdateCommand.Parameters["@name"].Value = cus.name;
				daCustomer.UpdateCommand.Parameters["@sex"].Value = cus.sex;
				daCustomer.UpdateCommand.Parameters["@id1"].Value = cus.id1;
				daCustomer.UpdateCommand.Parameters["@id2"].Value = cus.id2;
				daCustomer.UpdateCommand.Parameters["@id3"].Value = cus.id3;				
				daCustomer.UpdateCommand.Parameters["@phone"].Value = cus.phone;
				daCustomer.UpdateCommand.Parameters["@email"].Value = cus.email;
				daCustomer.UpdateCommand.Parameters["@industry"].Value = cus.industry;
				daCustomer.UpdateCommand.Parameters["@job"].Value = cus.job;
				daCustomer.UpdateCommand.Parameters["@city"].Value = cus.city;
				daCustomer.UpdateCommand.Parameters["@district"].Value = cus.district;
				daCustomer.UpdateCommand.Parameters["@addr"].Value = cus.addr;
				daCustomer.UpdateCommand.Parameters["@note"].Value = cus.note;
				daCustomer.UpdateCommand.Parameters["@opid"].Value = (cus.opid < 0 ? Math.Abs(cus.opid) : op.opid);

				daCustomer.UpdateCommand.ExecuteNonQuery();

				msg = daCustomer.UpdateCommand.Parameters["@msg"].Value.ToString();
			}
			catch (Exception ex) {
				AsyncLogWriter("SaveCustomer :" + ex);
				msg = ex.ToString();
			}
			finally {
				con.Close();
			}

			return msg;
		}
Beispiel #2
0
		protected void buttonSaveCus_Click(object sender, System.EventArgs e) {
			try {
				Customer cus = new Customer();
				cus.name = textCusFName.Text + " " + textCusLName.Text;
				cus.id1 = textCusId1.Text;
				cus.id2 = textCusId2.Text;
				cus.id3 = textCusId3.Text;
				cus.addr = textCusAddr.Text;
				cus.phone = textCusPhone.Text;
				cus.email = textCusEmail.Text;
				cus.job = comboCusProf.SelectedValue;
				cus.industry = comboCusIndustry.SelectedValue;
				cus.sex = comboCusSex.SelectedValue;
				cus.city = comboCusCity.SelectedValue;
				cus.district = "";
				cus.note = "";

				cus.isdn = textPhone.Text;
				cus.opid = this.PspProxy.CurrentOperator.opid;
				cus.status = labelStatus.Text;

				try {
					cus.district = comboCusDistrict.SelectedValue;
				}
				catch {}
      
				string msg = this.PspProxy.SaveCustomer(cus);

				if (msg.Length == 0) {
					SetCustomerMode(true);
					labelCusStatus.CssClass = "caption";
					labelCusStatus.Text = "Бvртгэл амжилттай орлоо";
				}
				else {
					SetCustomerMode(false);
					labelCusStatus.CssClass = "error";
					labelCusStatus.Text = msg;
				}
			}
			catch (Exception ex) {
				SetCustomerMode(true);
				labelCusStatus.CssClass = "error";
				labelCusStatus.Text = ex.ToString();
			}
			finally {
				labelCusRegStaff.Text = this.PspProxy.CurrentOperator.uid;
			}
		}