Beispiel #1
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         StorgeJS  entity = (StorgeJS)p_BE;
         string    sql    = "SELECT * FROM WH_StorgeJS WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("单号已存在,请检查后重新输入!");    // 检查是否已存在
         }
         StorgeJSCtl control = new StorgeJSCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_StorgeJS, sqlTrans);
         control.AddNew(entity);
         FormNoControlRule rulest = new FormNoControlRule();
         rulest.RAddSort((int)FormNoControlEnum.结算单号, sqlTrans);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            StorgeJSRule rule   = new StorgeJSRule();
            StorgeJS     entity = EntityGet();

            rule.RUpdate(entity);
        }
Beispiel #3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                StorgeJS MasterEntity = (StorgeJS)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM WH_StorgeJS WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private StorgeJS EntityGet()
        {
            StorgeJS entity = new StorgeJS();

            entity.ID = HTDataID;
            return(entity);
        }
Beispiel #5
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            StorgeJSRule rule   = new StorgeJSRule();
            StorgeJS     entity = EntityGet();

            rule.RAdd(entity);
            return(entity.ID);
        }
Beispiel #6
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private StorgeJS EntityGet()
        {
            StorgeJS entity = new StorgeJS();

            entity.ID = HTDataID;
            entity.SelectByID();
            entity.FormNo   = txtFormNo.Text.Trim();
            entity.FormDate = txtFormDate.DateTime.Date;
            entity.JSDateS  = txtJSDateS.DateTime.Date;
            entity.JSDateE  = txtJSDateE.DateTime.Date;
            entity.FormOPID = drpMakeOPID.EditValue.ToString();

            entity.Remark = txtRemark.Text.Trim();

            return(entity);
        }
Beispiel #7
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         StorgeJS    entity  = (StorgeJS)p_BE;
         StorgeJSCtl control = new StorgeJSCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #8
0
        private void SetSubStatus()
        {
            ButtonItem btnJs       = ToolBarItemGet(-1, "btnJs");
            ButtonItem btnJsCancel = ToolBarItemGet(-1, "btnJsCancel");
            StorgeJS   entity      = new StorgeJS();

            entity.ID = HTDataID;
            entity.SelectByID();
            if (entity.JSFlag == 1)
            {
                btnJs.Enabled       = false;
                btnJsCancel.Enabled = true;
            }
            else
            {
                btnJs.Enabled       = true;
                btnJsCancel.Enabled = false;
            }
        }
Beispiel #9
0
        private void btnJs_Click(object sender, EventArgs e)
        {
            try
            {
                if (HTFormStatus == FormStatus.新增 || HTFormStatus == FormStatus.修改)
                {
                    this.ShowMessage("请先保存单据后再进行结算操作");
                    return;
                }
                StorgeJS entity = new StorgeJS();
                entity.ID = HTDataID;
                entity.SelectByID();
                if (entity.SubmitFlag == (int)YesOrNo.No)
                {
                    this.ShowMessage("请先提交单据后再进行结算");
                    return;
                }
                if (entity.JSFlag == (int)YesOrNo.Yes)
                {
                    this.ShowMessage("该单据已经进行结算,请核对");
                    return;
                }

                SqlParameter[] param = new SqlParameter[2];
                param[0]       = new SqlParameter("@JSID", SqlDbType.Int);
                param[0].Value = SysConvert.ToInt32(HTDataID);//ID

                param[1]       = new SqlParameter("@JSOPID", SqlDbType.VarChar, 50);
                param[1].Value = SysConvert.ToString(FParamConfig.LoginID);//结算人ID

                DataTable dt = SysUtils.ExecuteStoredProc("USP3_WH_JSEXEC", param);
                gridView1.GridControl.DataSource = dt;
                gridView1.GridControl.Show();
                BindGrid();
                SetSubStatus();
                lblJS.Text = "已结算";
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            StorgeJS entity = new StorgeJS();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            HTDataFormNo = entity.FormNo;

            txtFormNo.Text        = entity.FormNo.ToString();
            txtFormDate.DateTime  = entity.FormDate;
            txtJSDateS.DateTime   = entity.JSDateS;
            txtJSDateE.DateTime   = entity.JSDateE;
            drpMakeOPID.EditValue = entity.FormOPID;
            txtRemark.Text        = entity.Remark.ToString();
            HTDataSubmitFlag      = entity.SubmitFlag;
            HTDataDelFlag         = entity.DelFlag;
            lblJS.ForeColor       = Color.Red;
            if (!findFlag)
            {
            }
            switch (entity.JSFlag)
            {
            case 1:
                lblJS.Text = "已结算";

                break;

            case 0:
                lblJS.Text = "未结算";
                break;

            default:
                lblJS.Text = ""; break;
            }
            SetSubStatus();
            BindGrid();
        }
Beispiel #11
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         StorgeJS  entity = (StorgeJS)p_BE;
         string    sql    = "SELECT * FROM WH_StorgeJS WHERE FormNo=" + SysString.ToDBString(entity.FormNo) + " AND ID<>" + entity.ID;
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("单号已存在,请检查后重新输入!");    // 检查是否已存在
         }
         StorgeJSCtl control = new StorgeJSCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #12
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                StorgeJS MasterEntity = (StorgeJS)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO WH_StorgeJS(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("FormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ",");
                MasterField.Append("FormDate" + ",");
                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("JSDateS" + ",");
                if (MasterEntity.JSDateS != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.JSDateS.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("JSDateE" + ",");
                if (MasterEntity.JSDateE != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.JSDateE.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("JSFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JSFlag) + ",");
                MasterField.Append("JSTime" + ",");
                if (MasterEntity.JSTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.JSTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("FormOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormOPID) + ",");
                MasterField.Append("JSOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JSOPID) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("SubmitFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                MasterField.Append("DelFlag" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Beispiel #13
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                StorgeJS MasterEntity = (StorgeJS)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE WH_StorgeJS SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" FormNo=" + SysString.ToDBString(MasterEntity.FormNo) + ",");

                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" FormDate=" + SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FormDate=null,");
                }


                if (MasterEntity.JSDateS != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" JSDateS=" + SysString.ToDBString(MasterEntity.JSDateS.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" JSDateS=null,");
                }


                if (MasterEntity.JSDateE != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" JSDateE=" + SysString.ToDBString(MasterEntity.JSDateE.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" JSDateE=null,");
                }

                UpdateBuilder.Append(" JSFlag=" + SysString.ToDBString(MasterEntity.JSFlag) + ",");

                if (MasterEntity.JSTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" JSTime=" + SysString.ToDBString(MasterEntity.JSTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" JSTime=null,");
                }

                UpdateBuilder.Append(" FormOPID=" + SysString.ToDBString(MasterEntity.FormOPID) + ",");
                UpdateBuilder.Append(" JSOPID=" + SysString.ToDBString(MasterEntity.JSOPID) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
Beispiel #14
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     StorgeJS entity = (StorgeJS)p_BE;
 }