protected void Page_Load(object sender, EventArgs e)
        {
            //先得到操作类型
            SchSystem.BLL.WebSchChn   schchn_bll   = new SchSystem.BLL.WebSchChn();
            SchSystem.Model.WebSchChn schchn_model = new SchSystem.Model.WebSchChn();
            SysType = Com.Public.SqlEncStr(Request.Params["dotype"].ToString());


            if (SysType == "e")//修改,不能修改用户的类型及学校参数
            {
                //获取修改的对应用户的

                ChnId        = Com.Public.SqlEncStr(Request.Params["id"].ToString());
                schchn_model = schchn_bll.GetModel(int.Parse(ChnId));
                if (schchn_model != null && schchn_model.ChnId > 0)
                {
                    umodelstr = Newtonsoft.Json.JsonConvert.SerializeObject(schchn_model);
                }
                else
                {
                    Response.Write("无该名称!");
                    Response.End();
                }
                chndrp = Com.Public.GetDrp("chn", Com.Session.schid, "1", false, ChnId, schchn_model.Pid.ToString());
            }
            else//不在添加及修改之内,则返回
            {
                chndrp = Com.Public.GetDrp("chn", Com.Session.schid, "1", false, "", "");
            }
        }
Example #2
0
        public static Com.DataPack.DataRsp <string> udel(string id)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    //看是否已有新闻关联,需要补


                    SchSystem.BLL.WebSchChn   bll   = new SchSystem.BLL.WebSchChn();
                    SchSystem.Model.WebSchChn model = new SchSystem.Model.WebSchChn();
                    model.ChnId = int.Parse(id);
                    model.Stat  = 2;
                    //删除时判断是否有子栏目
                    if (!bll.Exists(int.Parse(id)))
                    {
                        SchSystem.BLL.WebSchNews bllnew = new SchSystem.BLL.WebSchNews();
                        if (!bllnew.ExistsChn(int.Parse(id)))
                        {
                            if (bll.UpdateStat(model))
                            {
                                rsp.code = "success";
                                rsp.msg  = "操作成功";
                            }
                            else
                            {
                                rsp.code = "error";
                                rsp.msg  = "操作失败";
                            }
                        }
                        else
                        {
                            rsp.code = "error";
                            rsp.msg  = "该栏目下还有文章,请删除文章后再删除该栏目!";
                        }
                    }
                    else
                    {
                        rsp.code = "error";
                        rsp.msg  = "请先删除子栏目!";
                    }
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Example #3
0
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string txtname, string ustat, string txtcode)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    //Stat:0废弃,1正常,2被删除,正常界面不显示删除,超管界面可以考虑
                    string strwhere = "Stat<2 and SchId='" + Com.Session.schid + "' ";

                    if (!string.IsNullOrEmpty(txtcode))
                    {
                        strwhere += " and ChnCode = " + int.Parse(Com.Public.SqlEncStr(txtcode));
                    }
                    if (!string.IsNullOrEmpty(txtname))
                    {
                        strwhere += " and ChnName like '%" + Com.Public.SqlEncStr(txtname) + "%'";
                    }
                    if (!string.IsNullOrEmpty(ustat))
                    {
                        strwhere += " and Stat='" + Com.Public.SqlEncStr(ustat) + "'";
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int rowc = 0;
                    int pc   = 0;
                    SchSystem.BLL.WebSchChn userbll = new SchSystem.BLL.WebSchChn();
                    string    dbcols = "ChnId,Pid,SchId,ChnName,ChnCode,OrderId,Stat,Note";
                    DataTable dt     = userbll.GetListCols(dbcols, strwhere, "ChnCode", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        pages.list = dt;
                    }
                    rsp.data = Newtonsoft.Json.JsonConvert.SerializeObject(pages).Replace("\n\r", "");
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SchId = Com.Session.schid;
            //栏目初始化
            SchSystem.BLL.WebSchChn SchChn = new SchSystem.BLL.WebSchChn();
            DataTable dtSchChn             = SchChn.GetList("ChnName,ChnCode", "Stat=1").Tables[0];

            SchChnJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchChn);
            //年级
            SchSystem.BLL.SchGradeInfo schgrade = new SchSystem.BLL.SchGradeInfo();
            DataTable dtSchGrade = schgrade.GetList("GradeName,GradeCode", "IsFinish=0 and SchId=" + SchId).Tables[0];
            string    GradeCode  = dtSchGrade.Rows[0]["GradeCode"].ToString();

            SchGradeJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchGrade);
            //班级
            SchSystem.BLL.SchClassInfo schclass = new SchSystem.BLL.SchClassInfo();
            DataTable dtSchClass = schclass.GetList("ClassName,ClassId", "IsFinish=0 and GradeCode='" + GradeCode + "' and SchId='" + SchId + "'").Tables[0];

            SchClassJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dtSchClass);
        }
 public static Com.DataPack.DataRsp <string> save(string Chnid, string ChnName, string ChnCode, string Note, string Stat, string Pid)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         try
         {
             SchSystem.BLL.WebSchChn   schchn_bll   = new SchSystem.BLL.WebSchChn();
             SchSystem.Model.WebSchChn schchn_model = new SchSystem.Model.WebSchChn();
             schchn_model.ChnName = Com.Public.SqlEncStr(ChnName).ToString();
             schchn_model.Stat    = Convert.ToInt32(Com.Public.SqlEncStr(Stat));
             schchn_model.ChnCode = Convert.ToInt32(Com.Public.SqlEncStr(ChnCode));
             schchn_model.Note    = Com.Public.SqlEncStr(Note).ToString();
             schchn_model.Pid     = Convert.ToInt32(Pid);
             schchn_model.SchId   = Convert.ToInt32(Com.Session.schid.ToString());
             if (Chnid != "")
             {
                 schchn_model.ChnId = Convert.ToInt32(Chnid);
                 //判断栏目代码不允许重复
                 if (!schchn_bll.ExistsChnCode(schchn_model.ChnId, schchn_model.ChnCode, schchn_model.SchId))
                 {
                     if (schchn_bll.CUpdate(schchn_model))
                     {
                         rsp.code = "success";
                         rsp.msg  = "修改成功";
                     }
                 }
                 else
                 {
                     rsp.code = "error";
                     rsp.msg  = "代码重复";
                 }
             }
             else
             {
                 schchn_model.RecName = Com.Session.uname.ToString();
                 schchn_model.RecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                 schchn_model.RecUser = Com.Session.userid.ToString();
                 //判断栏目代码不允许重复
                 if (!schchn_bll.ExistsChnCode(schchn_model.ChnId, schchn_model.ChnCode, schchn_model.SchId))
                 {
                     if (schchn_bll.Add(schchn_model) != 0)
                     {
                         rsp.code = "success";
                         rsp.msg  = "添加成功";
                     }
                 }
                 else
                 {
                     rsp.code = "error";
                     rsp.msg  = "代码重复";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "error";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }