Beispiel #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bsam.Core.Model.Models.Model.Inv_Bill_Dtl DataRowToModel(DataRow row)
 {
     Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model = new Bsam.Core.Model.Models.Model.Inv_Bill_Dtl();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["BillId"] != null && row["BillId"].ToString() != "")
         {
             model.BillId = int.Parse(row["BillId"].ToString());
         }
         if (row["MitemCode"] != null)
         {
             model.MitemCode = row["MitemCode"].ToString();
         }
         if (row["PlanQty"] != null && row["PlanQty"].ToString() != "")
         {
             model.PlanQty = decimal.Parse(row["PlanQty"].ToString());
         }
         if (row["ActualQty"] != null && row["ActualQty"].ToString() != "")
         {
             model.ActualQty = decimal.Parse(row["ActualQty"].ToString());
         }
         if (row["DateTimeCreated"] != null && row["DateTimeCreated"].ToString() != "")
         {
             model.DateTimeCreated = DateTime.Parse(row["DateTimeCreated"].ToString());
         }
         if (row["UserCreator"] != null)
         {
             model.UserCreator = row["UserCreator"].ToString();
         }
         if (row["DateTimeModified"] != null && row["DateTimeModified"].ToString() != "")
         {
             model.DateTimeModified = DateTime.Parse(row["DateTimeModified"].ToString());
         }
         if (row["UserModified"] != null)
         {
             model.UserModified = row["UserModified"].ToString();
         }
         if (row["State"] != null && row["State"].ToString() != "")
         {
             if ((row["State"].ToString() == "1") || (row["State"].ToString().ToLower() == "true"))
             {
                 model.State = true;
             }
             else
             {
                 model.State = false;
             }
         }
         if (row["OrgId"] != null)
         {
             model.OrgId = row["OrgId"].ToString();
         }
     }
     return(model);
 }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Inv_Bill_Dtl set ");
            strSql.Append("Id=@Id,");
            strSql.Append("BillId=@BillId,");
            strSql.Append("MitemCode=@MitemCode,");
            strSql.Append("PlanQty=@PlanQty,");
            strSql.Append("ActualQty=@ActualQty,");
            strSql.Append("DateTimeCreated=@DateTimeCreated,");
            strSql.Append("UserCreator=@UserCreator,");
            strSql.Append("DateTimeModified=@DateTimeModified,");
            strSql.Append("UserModified=@UserModified,");
            strSql.Append("State=@State,");
            strSql.Append("OrgId=@OrgId");
            strSql.Append(" where ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id",               DbType.Int32,   4),
                new SQLiteParameter("@BillId",           DbType.Int32,   4),
                new SQLiteParameter("@MitemCode",        DbType.String,  0),
                new SQLiteParameter("@PlanQty",          DbType.Decimal, 8),
                new SQLiteParameter("@ActualQty",        DbType.Decimal, 8),
                new SQLiteParameter("@DateTimeCreated",  DbType.Date),
                new SQLiteParameter("@UserCreator",      DbType.String,  0),
                new SQLiteParameter("@DateTimeModified", DbType.Date),
                new SQLiteParameter("@UserModified",     DbType.String,  0),
                new SQLiteParameter("@State",            DbType.bit,     1),
                new SQLiteParameter("@OrgId",            DbType.String, 0)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.BillId;
            parameters[2].Value  = model.MitemCode;
            parameters[3].Value  = model.PlanQty;
            parameters[4].Value  = model.ActualQty;
            parameters[5].Value  = model.DateTimeCreated;
            parameters[6].Value  = model.UserCreator;
            parameters[7].Value  = model.DateTimeModified;
            parameters[8].Value  = model.UserModified;
            parameters[9].Value  = model.State;
            parameters[10].Value = model.OrgId;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 private void ShowInfo()
 {
     Bsam.Core.Model.Models.BLL.Inv_Bill_Dtl   bll   = new Bsam.Core.Model.Models.BLL.Inv_Bill_Dtl();
     Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model = bll.GetModel();
     this.txtId.Text               = model.Id.ToString();
     this.txtBillId.Text           = model.BillId.ToString();
     this.txtMitemCode.Text        = model.MitemCode;
     this.txtPlanQty.Text          = model.PlanQty.ToString();
     this.txtActualQty.Text        = model.ActualQty.ToString();
     this.txtDateTimeCreated.Text  = model.DateTimeCreated.ToString();
     this.txtUserCreator.Text      = model.UserCreator;
     this.txtDateTimeModified.Text = model.DateTimeModified.ToString();
     this.txtUserModified.Text     = model.UserModified;
     this.chkState.Checked         = model.State;
     this.txtOrgId.Text            = model.OrgId;
 }
Beispiel #4
0
 private void ShowInfo()
 {
     Bsam.Core.Model.Models.BLL.Inv_Bill_Dtl   bll   = new Bsam.Core.Model.Models.BLL.Inv_Bill_Dtl();
     Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model = bll.GetModel();
     this.lblId.Text               = model.Id.ToString();
     this.lblBillId.Text           = model.BillId.ToString();
     this.lblMitemCode.Text        = model.MitemCode;
     this.lblPlanQty.Text          = model.PlanQty.ToString();
     this.lblActualQty.Text        = model.ActualQty.ToString();
     this.lblDateTimeCreated.Text  = model.DateTimeCreated.ToString();
     this.lblUserCreator.Text      = model.UserCreator;
     this.lblDateTimeModified.Text = model.DateTimeModified.ToString();
     this.lblUserModified.Text     = model.UserModified;
     this.lblState.Text            = model.State?"是":"否";
     this.lblOrgId.Text            = model.OrgId;
 }
Beispiel #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Inv_Bill_Dtl(");
            strSql.Append("Id,BillId,MitemCode,PlanQty,ActualQty,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId)");
            strSql.Append(" values (");
            strSql.Append("@Id,@BillId,@MitemCode,@PlanQty,@ActualQty,@DateTimeCreated,@UserCreator,@DateTimeModified,@UserModified,@State,@OrgId)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id",               DbType.Int32,   4),
                new SQLiteParameter("@BillId",           DbType.Int32,   4),
                new SQLiteParameter("@MitemCode",        DbType.String,  0),
                new SQLiteParameter("@PlanQty",          DbType.Decimal, 8),
                new SQLiteParameter("@ActualQty",        DbType.Decimal, 8),
                new SQLiteParameter("@DateTimeCreated",  DbType.Date),
                new SQLiteParameter("@UserCreator",      DbType.String,  0),
                new SQLiteParameter("@DateTimeModified", DbType.Date),
                new SQLiteParameter("@UserModified",     DbType.String,  0),
                new SQLiteParameter("@State",            DbType.bit,     1),
                new SQLiteParameter("@OrgId",            DbType.String, 0)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.BillId;
            parameters[2].Value  = model.MitemCode;
            parameters[3].Value  = model.PlanQty;
            parameters[4].Value  = model.ActualQty;
            parameters[5].Value  = model.DateTimeCreated;
            parameters[6].Value  = model.UserCreator;
            parameters[7].Value  = model.DateTimeModified;
            parameters[8].Value  = model.UserModified;
            parameters[9].Value  = model.State;
            parameters[10].Value = model.OrgId;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bsam.Core.Model.Models.Model.Inv_Bill_Dtl GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,BillId,MitemCode,PlanQty,ActualQty,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId from Inv_Bill_Dtl ");
            strSql.Append(" where ");
            SQLiteParameter[] parameters =
            {
            };

            Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model = new Bsam.Core.Model.Models.Model.Inv_Bill_Dtl();
            DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtId.Text))
            {
                strErr += "Id格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtBillId.Text))
            {
                strErr += "BillId格式错误!\\n";
            }
            if (this.txtMitemCode.Text.Trim().Length == 0)
            {
                strErr += "MitemCode不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtPlanQty.Text))
            {
                strErr += "PlanQty格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtActualQty.Text))
            {
                strErr += "ActualQty格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtDateTimeCreated.Text))
            {
                strErr += "DateTimeCreated格式错误!\\n";
            }
            if (this.txtUserCreator.Text.Trim().Length == 0)
            {
                strErr += "UserCreator不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtDateTimeModified.Text))
            {
                strErr += "DateTimeModified格式错误!\\n";
            }
            if (this.txtUserModified.Text.Trim().Length == 0)
            {
                strErr += "UserModified不能为空!\\n";
            }
            if (this.txtOrgId.Text.Trim().Length == 0)
            {
                strErr += "OrgId不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      Id               = int.Parse(this.txtId.Text);
            int      BillId           = int.Parse(this.txtBillId.Text);
            string   MitemCode        = this.txtMitemCode.Text;
            decimal  PlanQty          = decimal.Parse(this.txtPlanQty.Text);
            decimal  ActualQty        = decimal.Parse(this.txtActualQty.Text);
            DateTime DateTimeCreated  = DateTime.Parse(this.txtDateTimeCreated.Text);
            string   UserCreator      = this.txtUserCreator.Text;
            DateTime DateTimeModified = DateTime.Parse(this.txtDateTimeModified.Text);
            string   UserModified     = this.txtUserModified.Text;
            bool     State            = this.chkState.Checked;
            string   OrgId            = this.txtOrgId.Text;

            Bsam.Core.Model.Models.Model.Inv_Bill_Dtl model = new Bsam.Core.Model.Models.Model.Inv_Bill_Dtl();
            model.Id               = Id;
            model.BillId           = BillId;
            model.MitemCode        = MitemCode;
            model.PlanQty          = PlanQty;
            model.ActualQty        = ActualQty;
            model.DateTimeCreated  = DateTimeCreated;
            model.UserCreator      = UserCreator;
            model.DateTimeModified = DateTimeModified;
            model.UserModified     = UserModified;
            model.State            = State;
            model.OrgId            = OrgId;

            Bsam.Core.Model.Models.BLL.Inv_Bill_Dtl bll = new Bsam.Core.Model.Models.BLL.Inv_Bill_Dtl();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }