コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bsam.Core.Model.Models.Model.Sfc_Production_Bom model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Sfc_Production_Bom set ");
            strSql.Append("Id=@Id,");
            strSql.Append("ProductId=@ProductId,");
            strSql.Append("MitemId=@MitemId,");
            strSql.Append("ReqQty=@ReqQty,");
            strSql.Append("Version=@Version,");
            strSql.Append("VersionDesc=@VersionDesc,");
            strSql.Append("BatchNo=@BatchNo,");
            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,   8),
                new SQLiteParameter("@ProductId",        DbType.Int32,   4),
                new SQLiteParameter("@MitemId",          DbType.Int32,   4),
                new SQLiteParameter("@ReqQty",           DbType.Decimal, 8),
                new SQLiteParameter("@Version",          DbType.String,  0),
                new SQLiteParameter("@VersionDesc",      DbType.String,  0),
                new SQLiteParameter("@BatchNo",          DbType.String,  0),
                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.ProductId;
            parameters[2].Value  = model.MitemId;
            parameters[3].Value  = model.ReqQty;
            parameters[4].Value  = model.Version;
            parameters[5].Value  = model.VersionDesc;
            parameters[6].Value  = model.BatchNo;
            parameters[7].Value  = model.DateTimeCreated;
            parameters[8].Value  = model.UserCreator;
            parameters[9].Value  = model.DateTimeModified;
            parameters[10].Value = model.UserModified;
            parameters[11].Value = model.State;
            parameters[12].Value = model.OrgId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Bsam.Core.Model.Models.Model.Sfc_Production_Bom model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Sfc_Production_Bom(");
            strSql.Append("Id,ProductId,MitemId,ReqQty,Version,VersionDesc,BatchNo,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId)");
            strSql.Append(" values (");
            strSql.Append("@Id,@ProductId,@MitemId,@ReqQty,@Version,@VersionDesc,@BatchNo,@DateTimeCreated,@UserCreator,@DateTimeModified,@UserModified,@State,@OrgId)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id",               DbType.Int32,   8),
                new SQLiteParameter("@ProductId",        DbType.Int32,   4),
                new SQLiteParameter("@MitemId",          DbType.Int32,   4),
                new SQLiteParameter("@ReqQty",           DbType.Decimal, 8),
                new SQLiteParameter("@Version",          DbType.String,  0),
                new SQLiteParameter("@VersionDesc",      DbType.String,  0),
                new SQLiteParameter("@BatchNo",          DbType.String,  0),
                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.ProductId;
            parameters[2].Value  = model.MitemId;
            parameters[3].Value  = model.ReqQty;
            parameters[4].Value  = model.Version;
            parameters[5].Value  = model.VersionDesc;
            parameters[6].Value  = model.BatchNo;
            parameters[7].Value  = model.DateTimeCreated;
            parameters[8].Value  = model.UserCreator;
            parameters[9].Value  = model.DateTimeModified;
            parameters[10].Value = model.UserModified;
            parameters[11].Value = model.State;
            parameters[12].Value = model.OrgId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 private void ShowInfo()
 {
     Bsam.Core.Model.Models.BLL.Sfc_Production_Bom   bll   = new Bsam.Core.Model.Models.BLL.Sfc_Production_Bom();
     Bsam.Core.Model.Models.Model.Sfc_Production_Bom model = bll.GetModel();
     this.txtId.Text               = model.Id.ToString();
     this.txtProductId.Text        = model.ProductId.ToString();
     this.txtMitemId.Text          = model.MitemId.ToString();
     this.txtReqQty.Text           = model.ReqQty.ToString();
     this.txtVersion.Text          = model.Version;
     this.txtVersionDesc.Text      = model.VersionDesc;
     this.txtBatchNo.Text          = model.BatchNo;
     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;
 }
コード例 #4
0
 private void ShowInfo()
 {
     Bsam.Core.Model.Models.BLL.Sfc_Production_Bom   bll   = new Bsam.Core.Model.Models.BLL.Sfc_Production_Bom();
     Bsam.Core.Model.Models.Model.Sfc_Production_Bom model = bll.GetModel();
     this.lblId.Text               = model.Id.ToString();
     this.lblProductId.Text        = model.ProductId.ToString();
     this.lblMitemId.Text          = model.MitemId.ToString();
     this.lblReqQty.Text           = model.ReqQty.ToString();
     this.lblVersion.Text          = model.Version;
     this.lblVersionDesc.Text      = model.VersionDesc;
     this.lblBatchNo.Text          = model.BatchNo;
     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;
 }
コード例 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bsam.Core.Model.Models.Model.Sfc_Production_Bom GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,ProductId,MitemId,ReqQty,Version,VersionDesc,BatchNo,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId from Sfc_Production_Bom ");
            strSql.Append(" where ");
            SQLiteParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bsam.Core.Model.Models.Model.Sfc_Production_Bom DataRowToModel(DataRow row)
 {
     Bsam.Core.Model.Models.Model.Sfc_Production_Bom model = new Bsam.Core.Model.Models.Model.Sfc_Production_Bom();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["ProductId"] != null && row["ProductId"].ToString() != "")
         {
             model.ProductId = int.Parse(row["ProductId"].ToString());
         }
         if (row["MitemId"] != null && row["MitemId"].ToString() != "")
         {
             model.MitemId = int.Parse(row["MitemId"].ToString());
         }
         if (row["ReqQty"] != null && row["ReqQty"].ToString() != "")
         {
             model.ReqQty = decimal.Parse(row["ReqQty"].ToString());
         }
         if (row["Version"] != null)
         {
             model.Version = row["Version"].ToString();
         }
         if (row["VersionDesc"] != null)
         {
             model.VersionDesc = row["VersionDesc"].ToString();
         }
         if (row["BatchNo"] != null)
         {
             model.BatchNo = row["BatchNo"].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);
 }
コード例 #7
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtId.Text))
            {
                strErr += "Id格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtProductId.Text))
            {
                strErr += "ProductId格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtMitemId.Text))
            {
                strErr += "MitemId格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtReqQty.Text))
            {
                strErr += "ReqQty格式错误!\\n";
            }
            if (this.txtVersion.Text.Trim().Length == 0)
            {
                strErr += "Version不能为空!\\n";
            }
            if (this.txtVersionDesc.Text.Trim().Length == 0)
            {
                strErr += "VersionDesc不能为空!\\n";
            }
            if (this.txtBatchNo.Text.Trim().Length == 0)
            {
                strErr += "BatchNo不能为空!\\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      ProductId        = int.Parse(this.txtProductId.Text);
            int      MitemId          = int.Parse(this.txtMitemId.Text);
            decimal  ReqQty           = decimal.Parse(this.txtReqQty.Text);
            string   Version          = this.txtVersion.Text;
            string   VersionDesc      = this.txtVersionDesc.Text;
            string   BatchNo          = this.txtBatchNo.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.Sfc_Production_Bom model = new Bsam.Core.Model.Models.Model.Sfc_Production_Bom();
            model.Id               = Id;
            model.ProductId        = ProductId;
            model.MitemId          = MitemId;
            model.ReqQty           = ReqQty;
            model.Version          = Version;
            model.VersionDesc      = VersionDesc;
            model.BatchNo          = BatchNo;
            model.DateTimeCreated  = DateTimeCreated;
            model.UserCreator      = UserCreator;
            model.DateTimeModified = DateTimeModified;
            model.UserModified     = UserModified;
            model.State            = State;
            model.OrgId            = OrgId;

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