Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.sys_Field model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sys_Field(");
            strSql.Append("F_Key,F_CName,F_Remark)");
            strSql.Append(" values (");
            strSql.Append("@F_Key,@F_CName,@F_Remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_Key",    SqlDbType.VarChar,  50),
                new SqlParameter("@F_CName",  SqlDbType.NVarChar, 50),
                new SqlParameter("@F_Remark", SqlDbType.NVarChar, 200)
            };
            parameters[0].Value = model.F_Key;
            parameters[1].Value = model.F_CName;
            parameters[2].Value = model.F_Remark;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.sys_Field model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sys_Field set ");
            strSql.Append("F_Key=@F_Key,");
            strSql.Append("F_CName=@F_CName,");
            strSql.Append("F_Remark=@F_Remark");
            strSql.Append(" where FieldID=@FieldID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_Key",    SqlDbType.VarChar,   50),
                new SqlParameter("@F_CName",  SqlDbType.NVarChar,  50),
                new SqlParameter("@F_Remark", SqlDbType.NVarChar, 200),
                new SqlParameter("@FieldID",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.F_Key;
            parameters[1].Value = model.F_CName;
            parameters[2].Value = model.F_Remark;
            parameters[3].Value = model.FieldID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtF_Key.Text.Trim().Length == 0)
            {
                strErr += "应用字段关键字不能为空!\\n";
            }
            if (this.txtF_CName.Text.Trim().Length == 0)
            {
                strErr += "应用字段中文说明不能为空!\\n";
            }
            if (this.txtF_Remark.Text.Trim().Length == 0)
            {
                strErr += "描述说明不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string F_Key    = this.txtF_Key.Text;
            string F_CName  = this.txtF_CName.Text;
            string F_Remark = this.txtF_Remark.Text;

            Maticsoft.Model.sys_Field model = new Maticsoft.Model.sys_Field();
            model.F_Key    = F_Key;
            model.F_CName  = F_CName;
            model.F_Remark = F_Remark;

            Maticsoft.BLL.sys_Field bll = new Maticsoft.BLL.sys_Field();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Exemple #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtF_Key.Text.Trim().Length==0)
            {
                strErr+="应用字段关键字不能为空!\\n";
            }
            if(this.txtF_CName.Text.Trim().Length==0)
            {
                strErr+="应用字段中文说明不能为空!\\n";
            }
            if(this.txtF_Remark.Text.Trim().Length==0)
            {
                strErr+="描述说明不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string F_Key=this.txtF_Key.Text;
            string F_CName=this.txtF_CName.Text;
            string F_Remark=this.txtF_Remark.Text;

            Maticsoft.Model.sys_Field model=new Maticsoft.Model.sys_Field();
            model.F_Key=F_Key;
            model.F_CName=F_CName;
            model.F_Remark=F_Remark;

            Maticsoft.BLL.sys_Field bll=new Maticsoft.BLL.sys_Field();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Exemple #5
0
 private void ShowInfo(int FieldID)
 {
     Maticsoft.BLL.sys_Field   bll   = new Maticsoft.BLL.sys_Field();
     Maticsoft.Model.sys_Field model = bll.GetModel(FieldID);
     this.lblFieldID.Text  = model.FieldID.ToString();
     this.lblF_Key.Text    = model.F_Key;
     this.lblF_CName.Text  = model.F_CName;
     this.lblF_Remark.Text = model.F_Remark;
 }
Exemple #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_Field DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_Field model = new Maticsoft.Model.sys_Field();
     if (row != null)
     {
         if (row["FieldID"] != null && row["FieldID"].ToString() != "")
         {
             model.FieldID = int.Parse(row["FieldID"].ToString());
         }
         if (row["F_Key"] != null)
         {
             model.F_Key = row["F_Key"].ToString();
         }
         if (row["F_CName"] != null)
         {
             model.F_CName = row["F_CName"].ToString();
         }
         if (row["F_Remark"] != null)
         {
             model.F_Remark = row["F_Remark"].ToString();
         }
     }
     return(model);
 }
Exemple #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_Field GetModel(int FieldID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 FieldID,F_Key,F_CName,F_Remark from sys_Field ");
            strSql.Append(" where FieldID=@FieldID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FieldID", SqlDbType.Int, 4)
            };
            parameters[0].Value = FieldID;

            Maticsoft.Model.sys_Field model = new Maticsoft.Model.sys_Field();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #8
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_Field DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_Field model=new Maticsoft.Model.sys_Field();
     if (row != null)
     {
         if(row["FieldID"]!=null && row["FieldID"].ToString()!="")
         {
             model.FieldID=int.Parse(row["FieldID"].ToString());
         }
         if(row["F_Key"]!=null)
         {
             model.F_Key=row["F_Key"].ToString();
         }
         if(row["F_CName"]!=null)
         {
             model.F_CName=row["F_CName"].ToString();
         }
         if(row["F_Remark"]!=null)
         {
             model.F_Remark=row["F_Remark"].ToString();
         }
     }
     return model;
 }
Exemple #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_Field GetModel(int FieldID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 FieldID,F_Key,F_CName,F_Remark from sys_Field ");
            strSql.Append(" where FieldID=@FieldID");
            SqlParameter[] parameters = {
                    new SqlParameter("@FieldID", SqlDbType.Int,4)
            };
            parameters[0].Value = FieldID;

            Maticsoft.Model.sys_Field model=new Maticsoft.Model.sys_Field();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }