private void InsertData() { bool ret = true; CustomerFlow cusFlow = new CustomerFlow(); CustomerData cusData = new CustomerData(); //cusData.CODE = CustomerFlow.GenerateCusCode(); cusData.CODE = txtCusCode.Text.Trim(); GetData(cusData); ret = cusFlow.InsertData(Authz.CurrentUserInfo.UserID, cusData); if (ret == false) Appz.ClientAlert(Page, cusFlow.ErrorMessage); else { ClearControls(); double LOID = cusFlow.GetLOID(cusData.CODE); LoadData(LOID.ToString()); Appz.ClientAlert(Page, "·Ó¡ÒèѴà¡çº¢éÍÁÙÅÅÙ¡¤éÒàÃÕºÃéÍÂ"); } }
private void UpdateData() { bool ret = true; CustomerFlow cusFlow = new CustomerFlow(); CustomerData cusData = new CustomerData(); cusData.CODE = txtCusCode.Text.Trim(); GetData(cusData); ret = cusFlow.UpdateData(Authz.CurrentUserInfo.UserID, cusData); if (ret == false) Appz.ClientAlert(Page, cusFlow.ErrorMessage); else { ClearControls(); LoadData(cusData.LOID.ToString()); Appz.ClientAlert(Page, "·Ó¡ÒÃá¡é䢢éÍÁÙÅÅÙ¡¤éÒàÃÕºÃéÍÂ"); } }
private bool ValidateInput() { if (txtCusCode.Text == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкØÃËÑÊÅÙ¡¤éÒ"); txtCusCode.Focus(); return false; } // -------------- ºØ¤¤Å ------------------------------------------- if (radPersonal.Checked == true) { if (txtPersonID.Text.Trim() == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкØÃËÑÊ»ÃШӵÑÇ»ÃЪҪ¹"); txtPersonID.Focus(); return false; } if (cmbTitle.SelectedIndex == 0) { Appz.ClientAlert(Page, "¡ÃسÒÃкؤӹÓ˹éÒª×èÍ"); return false; } if (txtFirstname.Text.Trim() == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкت×èÍÅÙ¡¤éÒ"); return false; } if (txtLastname.Text.Trim() == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкعÒÁÊ¡ØÅÅÙ¡¤éÒ"); return false; } } // -------------- àÍ¡ª¹ ------------------------------------------- if (radPrivate.Checked == true) { if (txtTaxNumber.Text.Trim() == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкØàÅ¢»ÃШӵÑǼÙéàÊÕÂÀÒÉÕ"); return false; } if (txtPrivateName.Text.Trim() == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкت×èͺÃÔÉÑ·"); return false; } } // -------------- ͧ¤ì¡Ã/˹èǧҹÃÑ° ------------------------------------------- if (radOrganize.Checked == true) { if (txtOrganizeName.Text.Trim() == "") { Appz.ClientAlert(Page, "¡ÃسÒÃкت×èÍͧ¤ì¡Ã/˹èǧҹÃÑ°"); return false; } } if (cmbMemberType.SelectedIndex == 0) { Appz.ClientAlert(Page, "¡ÃسÒÃкػÃÐàÀ·ÅÙ¡¤éÒ"); return false; } if (dtpEFDate.DateValue.Year == 1) { Appz.ClientAlert(Page, "¡ÃسÒÃкØÇѹ·Õèà»ç¹ÊÁÒªÔ¡"); return false; } if (dtpEPDate.DateValue.Year == 1) { Appz.ClientAlert(Page, "¡ÃسÒÃкØÇѹ·ÕèËÁ´ÍÒÂØ"); return false; } if (dtpEPDate.DateValue.CompareTo(dtpEFDate.DateValue) <= 0) { Appz.ClientAlert(Page, "Çѹ·ÕèäÁè¶Ù¡µéͧ"); return false; } if (cmbPaymentCondition.SelectedIndex == 0) { Appz.ClientAlert(Page, "¡ÃسÒÃкØà§×è͹䢡ÒêÓÃÐà§Ô¹"); return false; } if (txtCusZipCode.Text.Length > 5 || txtDeliveryZipCode.Text.Length > 5 || txtContactZipCode.Text.Length > 5) { Appz.ClientAlert(Page, "ÃËÑÊä»ÃɳÕÂìäÁè¶Ù¡µéͧ"); return false; } CustomerFlow cusFlow = new CustomerFlow(); if (cusFlow.GetLOIDbyIDENTITY(txtPersonID.Text) != 0 && cusFlow.GetLOIDbyIDENTITY(txtPersonID.Text) != Convert.ToDouble(txtLOID.Text == "" ? "0" : txtLOID.Text)) { Appz.ClientAlert(Page, "àÅ¢ºÑµÃ»ÃЪҪ¹«éÓ"); return false; } double LOID = cusFlow.GetLOID(txtCusCode.Text); if (LOID != 0 && LOID != Convert.ToDouble(txtLOID.Text == "" ? "0" : txtLOID.Text)) { Appz.ClientAlert(Page, "ÃËÑÊÅÙ¡¤éÒ«éÓ"); return false; } LOID = cusFlow.GetLOIDbyIDENTITY(txtTaxNumber.Text); if (LOID != 0 && LOID != Convert.ToDouble(txtLOID.Text == "" ? "0" : txtLOID.Text)) { Appz.ClientAlert(Page, "àÅ¢»ÃШӵÑǼÙéàÊÕÂÀÒÉÕ«éÓ"); return false; } return true; }