Example #1
0
 private DepartmentData GetData()
 {
     DepartmentData data = new DepartmentData();
     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;
     return data;
 }
Example #2
0
 private void SetData(DepartmentData 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;
 }
Example #3
0
 public DepartmentData GetData(double loid)
 {
     DepartmentData data = new DepartmentData();
     if (SearchDAL.GetDataByLOID(loid, null))
     {
         data.LOID = SearchDAL.LOID;
         data.CODE = SearchDAL.CODE;
         data.TNAME = SearchDAL.TNAME;
     }
     return data;
 }
Example #4
0
        public bool UpdateData(string userID, DepartmentData 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;

                    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;
        }
Example #5
0
 private bool VeridateData(DepartmentData 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;
     }
     return ret;
 }