Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Bsam.Core.Model.Models.Model.Inv_Loc model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Inv_Loc(");
            strSql.Append("Id,LocCode,LocName,LocDesc,LocStatus,LocOrder,Volume,VolumeUnit,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId,DistrictId,InvId)");
            strSql.Append(" values (");
            strSql.Append("@Id,@LocCode,@LocName,@LocDesc,@LocStatus,@LocOrder,@Volume,@VolumeUnit,@DateTimeCreated,@UserCreator,@DateTimeModified,@UserModified,@State,@OrgId,@DistrictId,@InvId)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id",               DbType.Int32,  8),
                new SQLiteParameter("@LocCode",          DbType.String, 0),
                new SQLiteParameter("@LocName",          DbType.String, 0),
                new SQLiteParameter("@LocDesc",          DbType.String, 0),
                new SQLiteParameter("@LocStatus",        DbType.String, 0),
                new SQLiteParameter("@LocOrder",         DbType.Int32,  4),
                new SQLiteParameter("@Volume",           DbType.Int32,  4),
                new SQLiteParameter("@VolumeUnit",       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),
                new SQLiteParameter("@DistrictId",       DbType.Int32,  4),
                new SQLiteParameter("@InvId",            DbType.Int32, 4)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.LocCode;
            parameters[2].Value  = model.LocName;
            parameters[3].Value  = model.LocDesc;
            parameters[4].Value  = model.LocStatus;
            parameters[5].Value  = model.LocOrder;
            parameters[6].Value  = model.Volume;
            parameters[7].Value  = model.VolumeUnit;
            parameters[8].Value  = model.DateTimeCreated;
            parameters[9].Value  = model.UserCreator;
            parameters[10].Value = model.DateTimeModified;
            parameters[11].Value = model.UserModified;
            parameters[12].Value = model.State;
            parameters[13].Value = model.OrgId;
            parameters[14].Value = model.DistrictId;
            parameters[15].Value = model.InvId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 private void ShowInfo()
 {
     Bsam.Core.Model.Models.BLL.Inv_Loc   bll   = new Bsam.Core.Model.Models.BLL.Inv_Loc();
     Bsam.Core.Model.Models.Model.Inv_Loc model = bll.GetModel();
     this.lblId.Text               = model.Id.ToString();
     this.lblLocCode.Text          = model.LocCode;
     this.lblLocName.Text          = model.LocName;
     this.lblLocDesc.Text          = model.LocDesc;
     this.lblLocStatus.Text        = model.LocStatus;
     this.lblLocOrder.Text         = model.LocOrder.ToString();
     this.lblVolume.Text           = model.Volume.ToString();
     this.lblVolumeUnit.Text       = model.VolumeUnit;
     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;
     this.lblDistrictId.Text       = model.DistrictId.ToString();
     this.lblInvId.Text            = model.InvId.ToString();
 }
Ejemplo n.º 3
0
 private void ShowInfo()
 {
     Bsam.Core.Model.Models.BLL.Inv_Loc   bll   = new Bsam.Core.Model.Models.BLL.Inv_Loc();
     Bsam.Core.Model.Models.Model.Inv_Loc model = bll.GetModel();
     this.txtId.Text               = model.Id.ToString();
     this.txtLocCode.Text          = model.LocCode;
     this.txtLocName.Text          = model.LocName;
     this.txtLocDesc.Text          = model.LocDesc;
     this.txtLocStatus.Text        = model.LocStatus;
     this.txtLocOrder.Text         = model.LocOrder.ToString();
     this.txtVolume.Text           = model.Volume.ToString();
     this.txtVolumeUnit.Text       = model.VolumeUnit;
     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;
     this.txtDistrictId.Text       = model.DistrictId.ToString();
     this.txtInvId.Text            = model.InvId.ToString();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bsam.Core.Model.Models.Model.Inv_Loc GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,LocCode,LocName,LocDesc,LocStatus,LocOrder,Volume,VolumeUnit,DateTimeCreated,UserCreator,DateTimeModified,UserModified,State,OrgId,DistrictId,InvId from Inv_Loc ");
            strSql.Append(" where ");
            SQLiteParameter[] parameters =
            {
            };

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

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

            if (!PageValidate.IsNumber(txtId.Text))
            {
                strErr += "Id格式错误!\\n";
            }
            if (this.txtLocCode.Text.Trim().Length == 0)
            {
                strErr += "LocCode不能为空!\\n";
            }
            if (this.txtLocName.Text.Trim().Length == 0)
            {
                strErr += "LocName不能为空!\\n";
            }
            if (this.txtLocDesc.Text.Trim().Length == 0)
            {
                strErr += "LocDesc不能为空!\\n";
            }
            if (this.txtLocStatus.Text.Trim().Length == 0)
            {
                strErr += "LocStatus不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtLocOrder.Text))
            {
                strErr += "LocOrder格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtVolume.Text))
            {
                strErr += "Volume格式错误!\\n";
            }
            if (this.txtVolumeUnit.Text.Trim().Length == 0)
            {
                strErr += "VolumeUnit不能为空!\\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 (!PageValidate.IsNumber(txtDistrictId.Text))
            {
                strErr += "DistrictId格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtInvId.Text))
            {
                strErr += "InvId格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      Id               = int.Parse(this.txtId.Text);
            string   LocCode          = this.txtLocCode.Text;
            string   LocName          = this.txtLocName.Text;
            string   LocDesc          = this.txtLocDesc.Text;
            string   LocStatus        = this.txtLocStatus.Text;
            int      LocOrder         = int.Parse(this.txtLocOrder.Text);
            int      Volume           = int.Parse(this.txtVolume.Text);
            string   VolumeUnit       = this.txtVolumeUnit.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;
            int      DistrictId       = int.Parse(this.txtDistrictId.Text);
            int      InvId            = int.Parse(this.txtInvId.Text);

            Bsam.Core.Model.Models.Model.Inv_Loc model = new Bsam.Core.Model.Models.Model.Inv_Loc();
            model.Id               = Id;
            model.LocCode          = LocCode;
            model.LocName          = LocName;
            model.LocDesc          = LocDesc;
            model.LocStatus        = LocStatus;
            model.LocOrder         = LocOrder;
            model.Volume           = Volume;
            model.VolumeUnit       = VolumeUnit;
            model.DateTimeCreated  = DateTimeCreated;
            model.UserCreator      = UserCreator;
            model.DateTimeModified = DateTimeModified;
            model.UserModified     = UserModified;
            model.State            = State;
            model.OrgId            = OrgId;
            model.DistrictId       = DistrictId;
            model.InvId            = InvId;

            Bsam.Core.Model.Models.BLL.Inv_Loc bll = new Bsam.Core.Model.Models.BLL.Inv_Loc();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bsam.Core.Model.Models.Model.Inv_Loc model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Inv_Loc set ");
            strSql.Append("Id=@Id,");
            strSql.Append("LocCode=@LocCode,");
            strSql.Append("LocName=@LocName,");
            strSql.Append("LocDesc=@LocDesc,");
            strSql.Append("LocStatus=@LocStatus,");
            strSql.Append("LocOrder=@LocOrder,");
            strSql.Append("Volume=@Volume,");
            strSql.Append("VolumeUnit=@VolumeUnit,");
            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("DistrictId=@DistrictId,");
            strSql.Append("InvId=@InvId");
            strSql.Append(" where ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Id",               DbType.Int32,  8),
                new SQLiteParameter("@LocCode",          DbType.String, 0),
                new SQLiteParameter("@LocName",          DbType.String, 0),
                new SQLiteParameter("@LocDesc",          DbType.String, 0),
                new SQLiteParameter("@LocStatus",        DbType.String, 0),
                new SQLiteParameter("@LocOrder",         DbType.Int32,  4),
                new SQLiteParameter("@Volume",           DbType.Int32,  4),
                new SQLiteParameter("@VolumeUnit",       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),
                new SQLiteParameter("@DistrictId",       DbType.Int32,  4),
                new SQLiteParameter("@InvId",            DbType.Int32, 4)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.LocCode;
            parameters[2].Value  = model.LocName;
            parameters[3].Value  = model.LocDesc;
            parameters[4].Value  = model.LocStatus;
            parameters[5].Value  = model.LocOrder;
            parameters[6].Value  = model.Volume;
            parameters[7].Value  = model.VolumeUnit;
            parameters[8].Value  = model.DateTimeCreated;
            parameters[9].Value  = model.UserCreator;
            parameters[10].Value = model.DateTimeModified;
            parameters[11].Value = model.UserModified;
            parameters[12].Value = model.State;
            parameters[13].Value = model.OrgId;
            parameters[14].Value = model.DistrictId;
            parameters[15].Value = model.InvId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bsam.Core.Model.Models.Model.Inv_Loc DataRowToModel(DataRow row)
 {
     Bsam.Core.Model.Models.Model.Inv_Loc model = new Bsam.Core.Model.Models.Model.Inv_Loc();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["LocCode"] != null)
         {
             model.LocCode = row["LocCode"].ToString();
         }
         if (row["LocName"] != null)
         {
             model.LocName = row["LocName"].ToString();
         }
         if (row["LocDesc"] != null)
         {
             model.LocDesc = row["LocDesc"].ToString();
         }
         if (row["LocStatus"] != null)
         {
             model.LocStatus = row["LocStatus"].ToString();
         }
         if (row["LocOrder"] != null && row["LocOrder"].ToString() != "")
         {
             model.LocOrder = int.Parse(row["LocOrder"].ToString());
         }
         if (row["Volume"] != null && row["Volume"].ToString() != "")
         {
             model.Volume = int.Parse(row["Volume"].ToString());
         }
         if (row["VolumeUnit"] != null)
         {
             model.VolumeUnit = row["VolumeUnit"].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();
         }
         if (row["DistrictId"] != null && row["DistrictId"].ToString() != "")
         {
             model.DistrictId = int.Parse(row["DistrictId"].ToString());
         }
         if (row["InvId"] != null && row["InvId"].ToString() != "")
         {
             model.InvId = int.Parse(row["InvId"].ToString());
         }
     }
     return(model);
 }