Ejemplo n.º 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(SchoolIF_Id))
                {
                    #region 添加
                    model               = new Model_TPSchoolIF();
                    model.SchoolIF_Id   = Guid.NewGuid().ToString();
                    model.SchoolIF_Name = txtSchoolIF_Name.Text;
                    model.SchoolIF_Code = ddlSchoolIF_Code.SelectedValue;
                    model.SchoolId      = hidtxtSchool.Value;
                    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("90200500", "修改学校接口配置成功");
                        ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>");
                        return;
                    }
                    #endregion
                }
                else
                {
                    #region 修改
                    model = bll.GetModel(SchoolIF_Id);
                    model.SchoolIF_Name = txtSchoolIF_Name.Text;
                    model.SchoolIF_Code = ddlSchoolIF_Code.SelectedValue;
                    model.SchoolId      = hidtxtSchool.Value;
                    model.Remark        = txtRemark.Text.Trim();
                    if (bll.Update(model))
                    {
                        new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("90200500", "修改学校接口配置成功");
                        ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>");
                    }
                    #endregion
                }
            }
            catch (Exception)
            {
                new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("90200500", "操作学校接口配置失败");
                ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>");
            }
        }
Ejemplo n.º 2
0
        public List <Model_TPSchoolIF> DataTableToList(DataTable dt)
        {
            List <Model_TPSchoolIF> list = new List <Model_TPSchoolIF>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_TPSchoolIF item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
        public bool Add(Model_TPSchoolIF model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into TPSchoolIF(");
            builder.Append("SchoolIF_Id,SchoolIF_Name,SchoolIF_Code,SchoolId,Remark,CreateUser,CreateTime)");
            builder.Append(" values (");
            builder.Append("@SchoolIF_Id,@SchoolIF_Name,@SchoolIF_Code,@SchoolId,@Remark,@CreateUser,@CreateTime)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SchoolIF_Id", SqlDbType.Char, 0x24), new SqlParameter("@SchoolIF_Name", SqlDbType.VarChar, 200), new SqlParameter("@SchoolIF_Code", SqlDbType.VarChar, 50), new SqlParameter("@SchoolId", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 0xfa0), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime) };
            cmdParms[0].Value = model.SchoolIF_Id;
            cmdParms[1].Value = model.SchoolIF_Name;
            cmdParms[2].Value = model.SchoolIF_Code;
            cmdParms[3].Value = model.SchoolId;
            cmdParms[4].Value = model.Remark;
            cmdParms[5].Value = model.CreateUser;
            cmdParms[6].Value = model.CreateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 修改时的默认值
 /// </summary>
 protected void loadData()
 {
     model = bll.GetModel(SchoolIF_Id);
     if (model == null)
     {
         return;
     }
     else
     {
         Model_UserGroup modelUG = new BLL_UserGroup().GetModel(model.SchoolId);
         if (modelUG != null)
         {
             txtSchool.Value = modelUG.UserGroup_Name;
         }
         hidtxtSchool.Value             = model.SchoolId;
         txtSchoolIF_Name.Text          = model.SchoolIF_Name;
         ddlSchoolIF_Code.SelectedValue = model.SchoolIF_Code;
         txtRemark.Text = model.Remark;
     }
 }
Ejemplo n.º 5
0
        public bool Update(Model_TPSchoolIF model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update TPSchoolIF set ");
            builder.Append("SchoolIF_Name=@SchoolIF_Name,");
            builder.Append("SchoolIF_Code=@SchoolIF_Code,");
            builder.Append("SchoolId=@SchoolId,");
            builder.Append("Remark=@Remark,");
            builder.Append("CreateUser=@CreateUser,");
            builder.Append("CreateTime=@CreateTime");
            builder.Append(" where SchoolIF_Id=@SchoolIF_Id ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SchoolIF_Name", SqlDbType.VarChar, 200), new SqlParameter("@SchoolIF_Code", SqlDbType.VarChar, 50), new SqlParameter("@SchoolId", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 0xfa0), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@SchoolIF_Id", SqlDbType.Char, 0x24) };
            cmdParms[0].Value = model.SchoolIF_Name;
            cmdParms[1].Value = model.SchoolIF_Code;
            cmdParms[2].Value = model.SchoolId;
            cmdParms[3].Value = model.Remark;
            cmdParms[4].Value = model.CreateUser;
            cmdParms[5].Value = model.CreateTime;
            cmdParms[6].Value = model.SchoolIF_Id;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 6
0
        public Model_TPSchoolIF DataRowToModel(DataRow row)
        {
            Model_TPSchoolIF lif = new Model_TPSchoolIF();

            if (row != null)
            {
                if (row["SchoolIF_Id"] != null)
                {
                    lif.SchoolIF_Id = row["SchoolIF_Id"].ToString();
                }
                if (row["SchoolIF_Name"] != null)
                {
                    lif.SchoolIF_Name = row["SchoolIF_Name"].ToString();
                }
                if (row["SchoolIF_Code"] != null)
                {
                    lif.SchoolIF_Code = row["SchoolIF_Code"].ToString();
                }
                if (row["SchoolId"] != null)
                {
                    lif.SchoolId = row["SchoolId"].ToString();
                }
                if (row["Remark"] != null)
                {
                    lif.Remark = row["Remark"].ToString();
                }
                if (row["CreateUser"] != null)
                {
                    lif.CreateUser = row["CreateUser"].ToString();
                }
                if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != ""))
                {
                    lif.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString()));
                }
            }
            return(lif);
        }
Ejemplo n.º 7
0
 public bool Add(Model_TPSchoolIF model)
 {
     return(this.dal.Add(model));
 }
Ejemplo n.º 8
0
 public bool Update(Model_TPSchoolIF model)
 {
     return(this.dal.Update(model));
 }