Пример #1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         int intSMSCount = 0;
         int.TryParse(txtSMSCount.Text, out intSMSCount);
         if (new BLL_SchoolSMS().GetRecordCount("School_Id='" + hidtxtSchool.Value.Trim() + "'") > 0)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.ready(function(){layer.msg('学校短信数据已存在,无法添加.', { time: 2000, icon: 2})});</script>");
             return;
         }
         #region 添加
         model             = new Model_SchoolSMS();
         model.School_Id   = hidtxtSchool.Value.Trim();
         model.School_Name = txtSchool.Value.Trim();
         model.SMSCount    = intSMSCount;
         model.Remark      = txtRemark.Text.Trim();
         model.CreateUser  = loginUser.SysUser_ID;
         model.CreateTime  = DateTime.Now;
         if (bll.Add(model))
         {
             new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("90200400", "新增学校短信配置信息成功");
             ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function(){layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});});</script>");
             return;
         }
         #endregion
     }
     catch (Exception)
     {
         new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("90207000", "操作学校短信配置信息失败");
         ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function(){layer.msg('操作失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});});</script>");
     }
 }
Пример #2
0
 /// <summary>
 /// 修改时的默认值
 /// </summary>
 protected void loadData()
 {
     model = bll.GetModel(School_Id);
     if (model == null)
     {
         return;
     }
     else
     {
         hidtxtSchool.Value = model.School_Id;
         txtSchool.Value    = model.School_Name;
         txtSMSCount.Text   = model.SMSCount.ToString();
         txtRemark.Text     = model.Remark;
     }
 }
Пример #3
0
        public List <Model_SchoolSMS> DataTableToList(DataTable dt)
        {
            List <Model_SchoolSMS> list = new List <Model_SchoolSMS>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_SchoolSMS item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Пример #4
0
        public bool Add(Model_SchoolSMS model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into SchoolSMS(");
            builder.Append("School_Id,School_Name,SMSCount,Remark,CreateUser,CreateTime,UpdateUser,UpdateTime)");
            builder.Append(" values (");
            builder.Append("@School_Id,@School_Name,@SMSCount,@Remark,@CreateUser,@CreateTime,@UpdateUser,@UpdateTime)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@School_Id", SqlDbType.VarChar, 50), new SqlParameter("@School_Name", SqlDbType.NVarChar, 250), new SqlParameter("@SMSCount", SqlDbType.Int, 4), new SqlParameter("@Remark", SqlDbType.VarChar, 0x3e8), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@UpdateTime", SqlDbType.DateTime) };
            cmdParms[0].Value = model.School_Id;
            cmdParms[1].Value = model.School_Name;
            cmdParms[2].Value = model.SMSCount;
            cmdParms[3].Value = model.Remark;
            cmdParms[4].Value = model.CreateUser;
            cmdParms[5].Value = model.CreateTime;
            cmdParms[6].Value = model.UpdateUser;
            cmdParms[7].Value = model.UpdateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Пример #5
0
        public Model_SchoolSMS DataRowToModel(DataRow row)
        {
            Model_SchoolSMS lsms = new Model_SchoolSMS();

            if (row != null)
            {
                if (row["School_Id"] != null)
                {
                    lsms.School_Id = row["School_Id"].ToString();
                }
                if (row["School_Name"] != null)
                {
                    lsms.School_Name = row["School_Name"].ToString();
                }
                if ((row["SMSCount"] != null) && (row["SMSCount"].ToString() != ""))
                {
                    lsms.SMSCount = new int?(int.Parse(row["SMSCount"].ToString()));
                }
                if (row["Remark"] != null)
                {
                    lsms.Remark = row["Remark"].ToString();
                }
                if (row["CreateUser"] != null)
                {
                    lsms.CreateUser = row["CreateUser"].ToString();
                }
                if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != ""))
                {
                    lsms.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString()));
                }
                if (row["UpdateUser"] != null)
                {
                    lsms.UpdateUser = row["UpdateUser"].ToString();
                }
                if ((row["UpdateTime"] != null) && (row["UpdateTime"].ToString() != ""))
                {
                    lsms.UpdateTime = new DateTime?(DateTime.Parse(row["UpdateTime"].ToString()));
                }
            }
            return(lsms);
        }
Пример #6
0
        public bool Update(Model_SchoolSMS model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update SchoolSMS set ");
            builder.Append("School_Name=@School_Name,");
            builder.Append("SMSCount=@SMSCount,");
            builder.Append("Remark=@Remark,");
            builder.Append("CreateUser=@CreateUser,");
            builder.Append("CreateTime=@CreateTime,");
            builder.Append("UpdateUser=@UpdateUser,");
            builder.Append("UpdateTime=@UpdateTime");
            builder.Append(" where School_Id=@School_Id ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@School_Name", SqlDbType.NVarChar, 250), new SqlParameter("@SMSCount", SqlDbType.Int, 4), new SqlParameter("@Remark", SqlDbType.VarChar, 0x3e8), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@UpdateTime", SqlDbType.DateTime), new SqlParameter("@School_Id", SqlDbType.VarChar, 50) };
            cmdParms[0].Value = model.School_Name;
            cmdParms[1].Value = model.SMSCount;
            cmdParms[2].Value = model.Remark;
            cmdParms[3].Value = model.CreateUser;
            cmdParms[4].Value = model.CreateTime;
            cmdParms[5].Value = model.UpdateUser;
            cmdParms[6].Value = model.UpdateTime;
            cmdParms[7].Value = model.School_Id;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Пример #7
0
 public bool Add(Model_SchoolSMS model)
 {
     return(this.dal.Add(model));
 }
Пример #8
0
 public bool Update(Model_SchoolSMS model)
 {
     return(this.dal.Update(model));
 }