Ejemplo n.º 1
0
 private bool ValidateData(ProductGroupData data)
 {
     bool ret = true;
     if (data.CODE.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃËÑÊ¡ÅØèÁÊÔ¹¤éÒ";
     }
     else if (data.PRODUCTTYPE == 0)
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡»ÃÐàÀ·ÊÔ¹¤éÒ";
     }
     else if (data.NAME.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкت×èÍ¡ÅØèÁÊÔ¹¤éÒ";
     }
     else if (DALObj.GetDataByCode(data.CODE, data.LOID, null))
     {
         ret = false;
         _error = "ÃËÑÊ¡ÅØèÁÊÔ¹¤éÒ«éÓ";
     }
     else if (DALObj.GetDataByName(data.NAME, data.PRODUCTTYPE, data.LOID, null))
     {
         ret = false;
         _error = "ª×èÍ¡ÅØèÁÊÔ¹¤éÒ«éÓ ã¹»ÃÐàÀ·ÊÔ¹¤éÒà´ÕÂǡѹ";
     }
     return ret;
 }
Ejemplo n.º 2
0
 private void SetData(ProductGroupData data)
 {
     this.txtLOID.Text = data.LOID.ToString();
     this.txtCode.Text = data.CODE.Trim();
     this.cmbProductType.SelectedIndex = this.cmbProductType.Items.IndexOf(this.cmbProductType.Items.FindByValue(data.PRODUCTTYPE.ToString()));
     this.chkActive.Checked = (data.ACTIVE == Constz.ActiveStatus.Active);
     this.txtName.Text = data.NAME.Trim();
 }
Ejemplo n.º 3
0
 private ProductGroupData GetData()
 {
     ProductGroupData data = new ProductGroupData();
     data.ACTIVE = (this.chkActive.Checked ? Constz.ActiveStatus.Active : Constz.ActiveStatus.InActive);
     data.CODE = this.txtCode.Text.Trim();
     data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.NAME = this.txtName.Text.Trim();
     data.PRODUCTTYPE = Convert.ToDouble(this.cmbProductType.SelectedItem.Value);
     return data;
 }
Ejemplo n.º 4
0
 public ProductGroupData GetData(double loid)
 {
     ProductGroupData data = new ProductGroupData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.ACTIVE = DALObj.ACTIVE;
         data.CODE = DALObj.CODE;
         data.LOID = DALObj.LOID;
         data.NAME = DALObj.NAME;
         data.PRODUCTTYPE = DALObj.PRODUCTTYPE;
     }
     return data;
 }
Ejemplo n.º 5
0
        public bool UpdateData(string userID, ProductGroupData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.LOID = data.LOID;
                    DALObj.NAME = data.NAME.Trim();
                    DALObj.PRODUCTTYPE = data.PRODUCTTYPE;
                    DALObj.ACTIVE = data.ACTIVE.Trim();
                    DALObj.CODE = data.CODE.Trim();

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    _LOID = DALObj.LOID;
                    if (!ret)
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                   _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }