Esempio n. 1
0
 private DivisionData GetData()
 {
     DivisionData data = new DivisionData();
     data.CODE = this.txtCode.Text.Trim();
     data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.TNAME = this.txtName.Text.Trim();
     data.EFDATE = this.ctlEFDate.DateValue;
     data.ABBNAME = this.txtAbbName.Text.Trim();
     data.DEPARTMENT = Convert.ToDouble(this.cmbDepartment.SelectedItem.Value);
     return data;
 }
Esempio n. 2
0
 private void SetData(DivisionData data)
 {
     this.txtLOID.Text = data.LOID.ToString();
     this.txtCode.Text = data.CODE.Trim();
     this.txtName.Text = data.TNAME.Trim();
     if (data.EFDATE.Year == 1)
         this.ctlEFDate.DateValue = DateTime.Now.Date;
     else
         this.ctlEFDate.DateValue = data.EFDATE;
     this.txtAbbName.Text = data.ABBNAME;
     this.cmbDepartment.SelectedIndex = this.cmbDepartment.Items.IndexOf(this.cmbDepartment.Items.FindByValue(data.DEPARTMENT.ToString()));
 }
Esempio n. 3
0
        public bool UpdateData(string userID, DivisionData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    SearchDAL.GetDataByLOID(data.LOID, obj.zTrans);
                    SearchDAL.LOID = data.LOID;
                    SearchDAL.TNAME = data.TNAME.Trim();
                    SearchDAL.CODE = data.CODE.Trim();
                    SearchDAL.EFDATE = data.EFDATE;
                    SearchDAL.EPDATE = data.EPDATE;
                    SearchDAL.ABBNAME = data.ABBNAME;
                    SearchDAL.DEPARTMENT = data.DEPARTMENT;

                    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;
        }
Esempio n. 4
0
 public DivisionData GetData(double loid)
 {
     DivisionData data = new DivisionData();
     if (SearchDAL.GetDataByLOID(loid, null))
     {
         data.LOID = SearchDAL.LOID;
         data.CODE = SearchDAL.CODE;
         data.TNAME = SearchDAL.TNAME;
         data.EFDATE = SearchDAL.EFDATE;
         data.EPDATE = SearchDAL.EPDATE;
         data.ABBNAME = SearchDAL.ABBNAME;
         data.DEPARTMENT = SearchDAL.DEPARTMENT;
     }
     return data;
 }
Esempio n. 5
0
 private bool VeridateData(DivisionData data)
 {
     bool ret = true;
     if (data.CODE.Trim() == "")
     {
         _error = "°√Ў≥“√–ЇЎ√Ћ— љи“¬";
         ret = false;
     }
     else if (data.TNAME.Trim() == "")
     {
         _error = "°√Ў≥“√–ЇЎ™„иЌј“…“дЈ¬";
         ret = false;
     }
     else if (SearchDAL.CheckCode(data.LOID, data.CODE.Trim()) == false)
     {
         _error = "√Ћ— љи“¬є’йЅ’Ќ¬ўиб≈й«";
         ret = false;
     }
     else if (SearchDAL.CheckName(data.LOID, data.TNAME.Trim()) == false)
     {
         _error = "™„иЌј“…“дЈ¬љи“¬є’йЅ’Ќ¬ўиб≈й«";
         ret = false;
     }
     else if (SearchDAL.CheckAbbName(data.LOID, data.ABBNAME.Trim()) == false)
     {
         _error = "™„荬荚蓬є’йЅ’Ќ¬ўиб≈й«";
         ret = false;
     }
     return ret;
 }