Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.sys_SystemInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sys_SystemInfo set ");
            strSql.Append("S_Name=@S_Name,");
            strSql.Append("S_Version=@S_Version,");
            strSql.Append("S_SystemConfigData=@S_SystemConfigData,");
            strSql.Append("S_Licensed=@S_Licensed");
            strSql.Append(" where SystemID=@SystemID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@S_Name",             SqlDbType.NVarChar, 50),
                new SqlParameter("@S_Version",          SqlDbType.NVarChar, 50),
                new SqlParameter("@S_SystemConfigData", SqlDbType.Image),
                new SqlParameter("@S_Licensed",         SqlDbType.VarChar,  50),
                new SqlParameter("@SystemID",           SqlDbType.Int, 4)
            };
            parameters[0].Value = model.S_Name;
            parameters[1].Value = model.S_Version;
            parameters[2].Value = model.S_SystemConfigData;
            parameters[3].Value = model.S_Licensed;
            parameters[4].Value = model.SystemID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_SystemInfo DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_SystemInfo model = new Maticsoft.Model.sys_SystemInfo();
     if (row != null)
     {
         if (row["SystemID"] != null && row["SystemID"].ToString() != "")
         {
             model.SystemID = int.Parse(row["SystemID"].ToString());
         }
         if (row["S_Name"] != null)
         {
             model.S_Name = row["S_Name"].ToString();
         }
         if (row["S_Version"] != null)
         {
             model.S_Version = row["S_Version"].ToString();
         }
         if (row["S_SystemConfigData"] != null && row["S_SystemConfigData"].ToString() != "")
         {
             model.S_SystemConfigData = (byte[])row["S_SystemConfigData"];
         }
         if (row["S_Licensed"] != null)
         {
             model.S_Licensed = row["S_Licensed"].ToString();
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.sys_SystemInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sys_SystemInfo(");
            strSql.Append("S_Name,S_Version,S_SystemConfigData,S_Licensed)");
            strSql.Append(" values (");
            strSql.Append("@S_Name,@S_Version,@S_SystemConfigData,@S_Licensed)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@S_Name",             SqlDbType.NVarChar, 50),
                new SqlParameter("@S_Version",          SqlDbType.NVarChar, 50),
                new SqlParameter("@S_SystemConfigData", SqlDbType.Image),
                new SqlParameter("@S_Licensed",         SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.S_Name;
            parameters[1].Value = model.S_Version;
            parameters[2].Value = model.S_SystemConfigData;
            parameters[3].Value = model.S_Licensed;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_SystemInfo DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_SystemInfo model=new Maticsoft.Model.sys_SystemInfo();
     if (row != null)
     {
         if(row["SystemID"]!=null && row["SystemID"].ToString()!="")
         {
             model.SystemID=int.Parse(row["SystemID"].ToString());
         }
         if(row["S_Name"]!=null)
         {
             model.S_Name=row["S_Name"].ToString();
         }
         if(row["S_Version"]!=null)
         {
             model.S_Version=row["S_Version"].ToString();
         }
         if(row["S_SystemConfigData"]!=null && row["S_SystemConfigData"].ToString()!="")
         {
             model.S_SystemConfigData=(byte[])row["S_SystemConfigData"];
         }
         if(row["S_Licensed"]!=null)
         {
             model.S_Licensed=row["S_Licensed"].ToString();
         }
     }
     return model;
 }
Example #5
0
 private void ShowInfo(int SystemID)
 {
     Maticsoft.BLL.sys_SystemInfo   bll   = new Maticsoft.BLL.sys_SystemInfo();
     Maticsoft.Model.sys_SystemInfo model = bll.GetModel(SystemID);
     this.lblSystemID.Text           = model.SystemID.ToString();
     this.lblS_Name.Text             = model.S_Name;
     this.lblS_Version.Text          = model.S_Version;
     this.lblS_SystemConfigData.Text = model.S_SystemConfigData.ToString();
     this.lblS_Licensed.Text         = model.S_Licensed;
 }
Example #6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtS_Name.Text.Trim().Length == 0)
            {
                strErr += "系统名称不能为空!\\n";
            }
            if (this.txtS_Version.Text.Trim().Length == 0)
            {
                strErr += "版本号不能为空!\\n";
            }
            if (this.txtS_Licensed.Text.Trim().Length == 0)
            {
                strErr += "序列号不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    SystemID  = int.Parse(this.lblSystemID.Text);
            string S_Name    = this.txtS_Name.Text;
            string S_Version = this.txtS_Version.Text;

            byte[] S_SystemConfigData = new UnicodeEncoding().GetBytes(this.txtS_SystemConfigData.Text);
            string S_Licensed         = this.txtS_Licensed.Text;


            Maticsoft.Model.sys_SystemInfo model = new Maticsoft.Model.sys_SystemInfo();
            model.SystemID           = SystemID;
            model.S_Name             = S_Name;
            model.S_Version          = S_Version;
            model.S_SystemConfigData = S_SystemConfigData;
            model.S_Licensed         = S_Licensed;

            Maticsoft.BLL.sys_SystemInfo bll = new Maticsoft.BLL.sys_SystemInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #7
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtS_Name.Text.Trim().Length==0)
            {
                strErr+="系统名称不能为空!\\n";
            }
            if(this.txtS_Version.Text.Trim().Length==0)
            {
                strErr+="版本号不能为空!\\n";
            }
            if(this.txtS_Licensed.Text.Trim().Length==0)
            {
                strErr+="序列号不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int SystemID=int.Parse(this.lblSystemID.Text);
            string S_Name=this.txtS_Name.Text;
            string S_Version=this.txtS_Version.Text;
            byte[] S_SystemConfigData= new UnicodeEncoding().GetBytes(this.txtS_SystemConfigData.Text);
            string S_Licensed=this.txtS_Licensed.Text;

            Maticsoft.Model.sys_SystemInfo model=new Maticsoft.Model.sys_SystemInfo();
            model.SystemID=SystemID;
            model.S_Name=S_Name;
            model.S_Version=S_Version;
            model.S_SystemConfigData=S_SystemConfigData;
            model.S_Licensed=S_Licensed;

            Maticsoft.BLL.sys_SystemInfo bll=new Maticsoft.BLL.sys_SystemInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Example #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_SystemInfo GetModel(int SystemID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 SystemID,S_Name,S_Version,S_SystemConfigData,S_Licensed from sys_SystemInfo ");
            strSql.Append(" where SystemID=@SystemID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SystemID", SqlDbType.Int, 4)
            };
            parameters[0].Value = SystemID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_SystemInfo GetModel(int SystemID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 SystemID,S_Name,S_Version,S_SystemConfigData,S_Licensed from sys_SystemInfo ");
            strSql.Append(" where SystemID=@SystemID");
            SqlParameter[] parameters = {
                    new SqlParameter("@SystemID", SqlDbType.Int,4)
            };
            parameters[0].Value = SystemID;

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