Beispiel #1
0
 private void doPost()
 {
     string cname = Request["cname"];
     light.BLL.leftmenu bll = new light.BLL.leftmenu();
     light.Model.leftmenu model = new light.Model.leftmenu();
     model.addtime = DateTime.Now;
     model.cnname = cname;
     model.enname = light.Common.Hz2Py.Convert(cname);
     model.isopen = 1;
     model.parentid = int.Parse(ViewState["pid"].ToString());
     bll.Add(model);
     WebMessageBox.ShowMessageBox("添加成功", this);
 }
Beispiel #2
0
 private void doPost()
 {
     string cname = Request["cname"];
     light.BLL.leftmenu bll = new light.BLL.leftmenu();
     if (!bll.Exists(cname))
     {
         model = bll.GetModel(int.Parse(ViewState["pid"].ToString()));
         model.cnname = cname;
         bll.Update(model);
         WebMessageBox.ShowMessageBox("修改成功", this);
     }
     else
     {
         WebMessageBox.ShowMessageBox("该菜单名已经存在", this);
     }
 }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int pid = light.Common.DNTRequest.GetQueryInt("pid", 0);
         if (pid > 0)
         {
             ViewState["pid"] = pid.ToString();
             model = new light.BLL.leftmenu().GetModel(pid);
         }
     }
     else
     {
         doPost();
     }
 }
Beispiel #4
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public light.Model.leftmenu GetModel(int pkid)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select * from leftmenu ");
            strSql.Append(" where pkid=@pkid ");
            OleDbParameter[] parameters = {
                    new OleDbParameter("@pkid", OleDbType.Integer,4)};
            parameters[0].Value = pkid;

            light.Model.leftmenu model=new light.Model.leftmenu();
            DataSet ds=DbHelperOleDb.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["pkid"].ToString()!="")
                {
                    model.pkid=int.Parse(ds.Tables[0].Rows[0]["pkid"].ToString());
                }
                model.cnname=ds.Tables[0].Rows[0]["cname"].ToString();
                model.enname=ds.Tables[0].Rows[0]["ename"].ToString();
                if(ds.Tables[0].Rows[0]["parentid"].ToString()!="")
                {
                    model.parentid=int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                }
                if(ds.Tables[0].Rows[0]["isopen"].ToString()!="")
                {
                    model.isopen=int.Parse(ds.Tables[0].Rows[0]["isopen"].ToString());
                }
                if(ds.Tables[0].Rows[0]["addtime"].ToString()!="")
                {
                    model.addtime=DateTime.Parse(ds.Tables[0].Rows[0]["addtime"].ToString());
                }
                model.c_description = ds.Tables[0].Rows[0]["c_description"].ToString();
                model.k_description = ds.Tables[0].Rows[0]["k_description"].ToString();
                model.e_description = ds.Tables[0].Rows[0]["e_description"].ToString();

                return model;
            }
            else
            {
                return null;
            }
        }