Exemple #1
0
 private void SetData(OfficerData data)
 {
     this.txtLOID.Text = data.LOID.ToString();
     this.txtName.Text = data.TNAME.Trim();
     this.txtLastname.Text = data.LASTNAME.Trim();
     this.cmbDivision.SelectedIndex = this.cmbDivision.Items.IndexOf(this.cmbDivision.Items.FindByValue(data.DIVISION.ToString()));
     this.txtUserID.Text = data.USERID.Trim();
     if (data.LOID != 0)
     {
         this.txtHidPass.Text = data.PASSWORD;
     }
     this.ctlEFDate.DateValue = data.EFDATE;
     this.txtNickname.Text = data.NICKNAME.Trim();
     this.ctlBirthdate.DateValue = data.BIRTHDATE;
     this.txtTel.Text = data.TEL.Trim();
     this.txtEMail.Text = data.EMAIL.Trim();
     this.txtAddress.Text = data.ADDRESS.Trim();
     this.txtRoad.Text = data.ROAD.Trim();
     this.cmbProvince.SelectedIndex = this.cmbProvince.Items.IndexOf(this.cmbProvince.Items.FindByValue(data.PROVINCE.ToString()));
     SetComboAmphur(cmbProvince, cmbAmphur);
     this.cmbAmphur.SelectedIndex = this.cmbAmphur.Items.IndexOf(this.cmbAmphur.Items.FindByValue(data.AMPHUR.ToString()));
     SetComboDistrict(cmbAmphur, cmbDistrict);
     this.cmbDistrict.SelectedIndex = this.cmbDistrict.Items.IndexOf(this.cmbDistrict.Items.FindByValue(data.TAMBOL.ToString()));
     this.txtZipcode.Text = data.ZIPCODE.Trim();
     this.txtRemark.Text = data.REMARK.Trim();
     this.cmbTitle.SelectedIndex = this.cmbTitle.Items.IndexOf(this.cmbTitle.Items.FindByValue(data.TITLE.ToString()));
 }
Exemple #2
0
 public OfficerData GetData(double loid)
 {
     OfficerData data = new OfficerData();
     if (SearchDAL.GetDataByLOID(loid, null))
     {
         data.LOID = SearchDAL.LOID;
         data.TNAME = SearchDAL.TNAME;
         data.LASTNAME = SearchDAL.LASTNAME;
         data.DIVISION = SearchDAL.DIVISION;
         data.USERID = SearchDAL.USERID;
         data.PASSWORD = AppFlow.Decrypt(SearchDAL.PASSWORD);
         data.EFDATE = SearchDAL.EFDATE;
         data.NICKNAME = SearchDAL.NICKNAME;
         data.BIRTHDATE = SearchDAL.BIRTHDATE;
         data.TEL = SearchDAL.TEL;
         data.EMAIL = SearchDAL.EMAIL;
         data.ADDRESS = SearchDAL.ADDRESS;
         data.ROAD = SearchDAL.ROAD;
         data.PROVINCE = SearchDAL.PROVINCE;
         data.AMPHUR = SearchDAL.AMPHUR;
         data.TAMBOL = SearchDAL.TAMBOL;
         data.ZIPCODE = SearchDAL.ZIPCODE;
         data.REMARK = SearchDAL.REMARK;
         data.TITLE = SearchDAL.TITLE;
     }
     return data;
 }
Exemple #3
0
 private OfficerData GetData()
 {
     OfficerData data = new OfficerData();
     data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.TNAME = this.txtName.Text.Trim();
     data.LASTNAME = this.txtLastname.Text.Trim();
     data.DIVISION = Convert.ToDouble(this.cmbDivision.SelectedItem.Value);
     data.USERID = this.txtUserID.Text.Trim();
     if (this.txtPassword.Text == "")
     {
         data.PASSWORD = this.txtHidPass.Text.Trim();
     }
     else
     {
         data.PASSWORD = this.txtPassword.Text.Trim();
     }
     if (this.txtPassConfirm.Text == "")
     {
         data.PASSCONFIRM = this.txtHidPass.Text.Trim();
     }
     else
     {
         data.PASSCONFIRM = this.txtPassConfirm.Text.Trim();
     }
     data.EFDATE = this.ctlEFDate.DateValue;
     data.NICKNAME = this.txtNickname.Text.Trim();
     data.BIRTHDATE = this.ctlBirthdate.DateValue;
     data.TEL = this.txtTel.Text.Trim();
     data.EMAIL = this.txtEMail.Text.Trim();
     data.ADDRESS = this.txtAddress.Text.Trim();
     data.ROAD = this.txtRoad.Text.Trim();
     data.PROVINCE = Convert.ToDouble(this.cmbProvince.SelectedItem.Value);
     data.AMPHUR = Convert.ToDouble(this.cmbAmphur.SelectedItem.Value);
     data.TAMBOL = Convert.ToDouble(this.cmbDistrict.SelectedItem.Value);
     data.ZIPCODE = this.txtZipcode.Text.Trim();
     data.REMARK = this.txtRemark.Text.Trim();
     data.TITLE = Convert.ToDouble(this.cmbTitle.SelectedItem.Value);
     return data;
 }
Exemple #4
0
 public OfficerData GetOfficerData(double loid)
 {
     OfficerDAL dal = new OfficerDAL();
     OfficerData data = new OfficerData();
     dal.GetDataByLOID(loid, null);
     data.TNAME = dal.TNAME;
     data.LASTNAME = dal.LASTNAME;
     data.DIVISION = dal.DIVISION;
     data.USERID = dal.USERID;
     data.PASSWORD = dal.PASSWORD;
     data.EFDATE = dal.EFDATE;
     data.EPDATE = dal.EPDATE;
     return data;
 }
Exemple #5
0
        public bool UpdateData(string userID, OfficerData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    SearchDAL.OnDB = false;
                    SearchDAL.GetDataByLOID(data.LOID, obj.zTrans);
                    SearchDAL.TNAME = data.TNAME.Trim();
                    SearchDAL.LASTNAME = data.LASTNAME.Trim();
                    SearchDAL.DIVISION = data.DIVISION;
                    SearchDAL.USERID = data.USERID;
                    SearchDAL.PASSWORD = AppFlow.Encrypt(data.PASSWORD);
                    SearchDAL.EFDATE = data.EFDATE;
                    SearchDAL.NICKNAME = data.NICKNAME;
                    SearchDAL.BIRTHDATE = data.BIRTHDATE;
                    SearchDAL.TEL = data.TEL;
                    SearchDAL.EMAIL = data.EMAIL;
                    SearchDAL.ADDRESS = data.ADDRESS;
                    SearchDAL.ROAD = data.ROAD;
                    SearchDAL.PROVINCE = data.PROVINCE;
                    SearchDAL.AMPHUR = data.AMPHUR;
                    SearchDAL.TAMBOL = data.TAMBOL;
                    SearchDAL.ZIPCODE = data.ZIPCODE;
                    SearchDAL.REMARK = data.REMARK;
                    SearchDAL.TITLE = data.TITLE;
                    
                    if (SearchDAL.OnDB)
                        ret = SearchDAL.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = SearchDAL.InsertCurrentData(userID, obj.zTrans);

                    _LOID = SearchDAL.LOID;

                    if (ret)
                    {
                        obj.zTrans.Commit();
                        obj.CloseConnection();
                    }
                    else
                    {
                        _error = SearchDAL.ErrorMessage;
                    }
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    throw new ApplicationException(ex.Message);
                }
            }
            else
                ret = false;
            return ret;
        }
Exemple #6
0
 private bool VeridateData(OfficerData data)
 {
     bool ret = true;
     if (data.LOID == 0)
     {
         if (data.PASSWORD.Trim() == "")
         {
             _error = "��س��к����ʼ�ҹ";
             ret = false;
         }
     }
     if (data.PASSWORD.Trim() != data.PASSCONFIRM.Trim())
     {
         _error = "�׹�ѹ���ʼ�ҹ���١��ͧ";
         ret = false;
     }
     else if (data.USERID.Trim() == "")
     {
         _error = "��س��кت�������к�";
         ret = false;
     }
     else if (data.TITLE == 0)
     {
         _error = "��س��кؤӹ�˹�Ҫ���";
         ret = false;
     }
     else if (data.TNAME.Trim() == "")
     {
         _error = "��س��кت��;�ѡ�ҹ";
         ret = false;
     }
     else if (data.LASTNAME.Trim() == "")
     {
         _error = "��س��кع��ʡ�ž�ѡ�ҹ";
         ret = false;
     }
     else if (data.NICKNAME.Trim() == "")
     {
         _error = "��س��кت�����蹾�ѡ�ҹ";
         ret = false;
     }
     else if (data.DIVISION == 0)
     {
         _error = "��س��кؽ���";
         ret = false;
     }
     else if (data.ZIPCODE.Trim() == "")
     {
         _error = "��س��к�������ɳ���";
         ret = false;
     }
     else if (data.PROVINCE == 0)
     {
         _error = "��س��кبѧ��Ѵ";
         ret = false;
     }
     else if (data.AMPHUR == 0)
     {
         _error = "��س��к������";
         ret = false;
     }
     else if (data.TAMBOL == 0)
     {
         _error = "��س��кصӺ�";
         ret = false;
     }
     else if (SearchDAL.CheckUserID(data.LOID, data.USERID.Trim()) == false)
     {
         _error = "���������������������";
         ret = false;
     }
     else if (SearchDAL.CheckName(data.LOID, data.TNAME.Trim(), data.LASTNAME.Trim()) == false)
     {
         _error = "������й��ʡ�Ź������������";
         ret = false;
     }
     return ret;
 }