Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     RomoveLink();
     roleId = QueryString["id"];
     if (!Page.IsPostBack)
     {
         if (String.IsNullOrEmpty(roleId))
         {
             Close("请先选择角色再进行菜单权限分配");
         }
         string strSql = "";
         try
         {
             DataFrom dataFrom = new DataFrom();
             lblRoleName.Text = dataFrom.GetScalar("select name from s_role where Id='" + roleId + "' and depid='" + CurrentUser.DepID + "'");
             strSql           = @"select f.id,f.Name as text,case when rf.roleid is null then 0 else 1 end as checked,f.parentid,f.sn 
                         from S_Fun f
                         left join S_RoleFun rf on rf.funid=f.id and rf.RoleId=" + roleId
                                + " where f.iflag=1 order by f.SN";
             DataTable dt = dataFrom.GetDataTable(strSql);
             if (dt != null)
             {
                 WebHelper.BindTreeView(dt, "0", tvFunctions);
             }
         }
         catch (Exception ex)
         {
             Logger.Error(strSql, ex);
             RedirectError("角色功能编辑初始化失败,请稍候再试。原因:" + ex.Message);
         }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            name = QueryString[Constants.MYQUERY_NAME];
            if (!Page.IsPostBack)
            {
                WebHelper.SetControlAttributes(btnSubmit, new TextBoxVal[] { txtTitle, HtmlUrl, AspxUrl });
                if (CurrentUser.IsAdmin())//仅管理员才能操作
                {
                    HtmlUrl.Enabled = true;
                    DepId.Enabled   = true;
                    divUp.Visible   = true;
                    btnUp.Visible   = true;
                    WebHelper.SetAttributesOfFile(fileHtml);
                    WebHelper.SetAttributesOfFile(fileXml);
                }
                else
                {
                    HtmlUrl.Enabled = false;
                    DepId.Enabled   = false;
                    divUp.Visible   = false;
                    btnUp.Visible   = false;
                }
                try
                {
                    DataFrom dataFrom = new DataFrom();
                    dataFrom.BindListCtrl(String.Format("select id,case when parentid='0' then '' else '  ' end+name from f_city where iflag=1 and (parentid='{0}' or id='{0}') order by parentid,id", CurrentUser.DepID), DepId, CurrentUser.IsAdmin());
                    if (!String.IsNullOrEmpty(name))
                    {
                        HtmlUrl.Text = name;
                        DataTable dt = dataFrom.GetDataTable("select Title,AspxUrl,depid from HtmlTemplate where HtmlUrl='" + name + "'");
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            txtTitle.Text = dt.Rows[0]["Title"].ToString();
                            AspxUrl.Text  = dt.Rows[0]["AspxUrl"].ToString();
                            WebHelper.SetSelCtrl(dt.Rows[0]["depid"].ToString(), DepId);
                        }
                        Content.Text = TxtHelper.GetString(WebHelper.GetMyXmlPath() + "\\tpl\\" + name + Constants.HTML_SUFFIX);

                        XmlDocument doc = FromXml.GetXml(name);
                        if (doc == null)
                        {
                            txtXml.Text = XmlHelper.GetXmlDocument(true).DocumentElement.OuterXml;
                        }
                        else
                        {
                            txtXml.Text = XmlHelper.GetFormatXml(doc);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("初始化失败", ex);
                    RedirectError("初始化失败,请稍候再试。原因:" + ex.Message);
                    return;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 设置WorkWeek信息
        /// </summary>
        /// <returns></returns>
        private void SetWorkWeekInfo()
        {
            DateTime startDate = DateTime.Today.AddMonths(-1);
            DateTime endDate   = DateTime.Today.AddMonths(1);

            if (this.IsPostBack && !String.IsNullOrEmpty(Request.Params["__EVENTARGUMENT"]))
            {
                string str = Request.Params["__EVENTARGUMENT"];
                if (str.StartsWith("V"))
                {
                    str = str.TrimStart('V');
                }

                this.ClientScript.RegisterHiddenField("__EVENTARGUMENT", str);

                startDate = new DateTime(2000, 1, 1);
                startDate = startDate.AddDays(Convert.ToInt32(str)).AddMonths(-1);
                endDate   = startDate.AddMonths(2);
            }
            string workWeekSql = "SELECT WORKDAY,iflag FROM WORKWEEK WHERE WORKDAY BETWEEN '{0}' AND '{1}'";

            dtWorkWeek = deal.GetDataTable(String.Format(workWeekSql, startDate, endDate));
        }