示例#1
0
 protected void gvShowUsersBind(int pageIndex)
 {
     List<UserDays> UserDaysList = new List<UserDays>();
     UserDaysList = new BindXML().GetUserInfoList(int.Parse(searchCondition.Year), searchCondition.UserName, searchCondition.WorkTime, searchCondition.Month);
     gvShowUsers.DataSource = UserDaysList;
     gvShowUsers.PageIndex = pageIndex;
     gvShowUsers.DataBind();
 }
 protected void dlYearBind()
 {
     var yearDic = new BindXML().BindYearDic();
     dlYear.DataSource = yearDic;
     dlYear.DataTextField = "Value";
     dlYear.DataValueField = "Key";
     dlYear.SelectedIndex = 1;
     dlYear.DataBind();
 }
 /// <summary>
 /// 删除单个用户时的数据绑定
 /// </summary>
 protected void dlYearDelBind()
 {
     var yearDic = new BindXML().BindYearDic();
     dlYearDel.DataSource = yearDic;
     dlYearDel.DataTextField = "Value";
     dlYearDel.DataValueField = "Key";
     dlYearDel.SelectedIndex = 1;
     searchYear = yearDic.ElementAt(1).Key;
     dlYearDel.DataBind();
 }
示例#4
0
 public void dlWorkTimeBind()
 {
     var workTimeDic = new BindXML().BindWorkTime();
     dlWorkTime.DataSource = workTimeDic;
     dlWorkTime.DataTextField = "Key";
     dlWorkTime.DataValueField = "Value";
     dlWorkTime.SelectedIndex = 0;
     searchCondition.WorkTime = workTimeDic.ElementAt(0).Value;
     dlWorkTime.DataBind();
 }
示例#5
0
 public void dlMonthBind()
 {
     var monthDic = new BindXML().BindMonths();
     dlMonth.DataSource = monthDic;
     dlMonth.DataTextField = "Key";
     dlMonth.DataValueField = "Value";
     dlMonth.SelectedIndex = DateTime.Now.Month - 1;
     searchCondition.Month = monthDic.ElementAt(DateTime.Now.Month - 1).Value;
     dlMonth.DataBind();
 }
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtNewName.Text) && !String.IsNullOrEmpty(dlOldName.SelectedValue))
     {
         bool updateSuccess = new BindXML().UpdateUserName(dlYear.SelectedValue, dlOldName.SelectedValue, txtNewName.Text);
         lblUpdateMessage.Text = updateSuccess ?
             "修改成功" :
             "未找到该成员!";
         lblUpdateMessage.CssClass = updateSuccess ? "alert alert-success" : "alert alert-danger";
     }
 }
 protected void dlUserNameBind(string year)
 {
     var userDic = new BindXML().BindUserName(year);
     dlUserName.DataSource = userDic;
     dlUserName.DataTextField = "Value";
     dlUserName.DataValueField = "Key";
     if (searchCondition != null && userDic.Count > 1)
     {
         searchCondition.UserName = userDic.ElementAt(0).Key;
     }
     dlUserName.DataBind();
 }
示例#8
0
        private void ddlYearBind()
        {
            var yearDic = new BindXML().BindYearDic();
            ddlOldYear.DataSource = yearDic;
            ddlOldYear.DataTextField = "Value";
            ddlOldYear.DataValueField = "Key";
            ddlOldYear.SelectedIndex = 1;
            ddlOldYear.DataBind();

            ddlNewYear.DataSource = yearDic;
            ddlNewYear.DataTextField = "Value";
            ddlNewYear.DataValueField = "Key";
            ddlNewYear.SelectedIndex = 2;
            ddlNewYear.DataBind();
        }
        protected void dlUserNameBind(string year)
        {
            var userDic = new BindXML().BindUserName(year);
            if (userDic == null)
            {
                dlOldName.DataSource = null;
                dlOldName.DataTextField = null;
                dlOldName.DataValueField = null;

            }
            else
            {
                userDic.Remove("All");
                dlOldName.DataSource = userDic;
                dlOldName.DataTextField = "Value";
                dlOldName.DataValueField = "Key";
            }

            dlOldName.DataBind();
        }
示例#10
0
 public void TransferOldYearToNewYear(string oldYear, string newYear, int[] nums)
 {
     var oldUserDic = new BindXML().BindUserName(oldYear);
         oldUserDic.Remove("All");//需删除ALL的值
         nums[0] = oldUserDic.Count;
         //从oldUserDic中取数据,再判断是否已存在于数据源中,如果没有,则创建,再插入进去
         foreach (var oldUser in oldUserDic.Values)
         {
             if (AddNewUserToXMLFile(newYear, oldUser))
             {
                 nums[1]++;
             }
             else
             {
                 nums[2]++;
             }
         }
 }
 protected void gvShowUsersBind()
 {
     string saveString = Request.MapPath("~/App_Data/shoushushiAdminTEMP.xml");
     XElement xlUserInfos = new BindXML().GetUserAndDaysAttribute(int.Parse(searchCondition.Year), searchCondition.UserName, searchCondition.WorkTime, searchCondition.Month);
     lock (thisLock)
     {
         xlUserInfos.Save(saveString);
     }
     XmlDataSource2.DataFile = saveString;
 }
        protected void gvShowUsers_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //输入的应该为数值,不能为字母等
            // Handle the new and original values.
            var newValues = e.NewValues;
            var oldValues = e.OldValues;

            lblMessage.Text = "";
            searchCondition = new SearchCondition();
            searchCondition.Department = System.Configuration.ConfigurationManager.AppSettings["Department"];
            searchCondition.UserName = oldValues[0].ToString();
            searchCondition.Year = oldValues[2].ToString();
            var workTimeDic = new BindXML().BindWorkTime();
            string workTimeKey = " ";
            bool findWorkKey = workTimeDic.TryGetValue(oldValues[1].ToString(), out workTimeKey);
            searchCondition.WorkTime = workTimeKey; //需改成WorkTime的格式
            var monthDic = new BindXML().BindMonths();
            string month = " ";
            bool findMonth = monthDic.TryGetValue(oldValues[3].ToString(), out month);
            searchCondition.Month = month;  //需改成月的格式

            new BindXML().UpdateUsersDays(int.Parse(searchCondition.Year), searchCondition.UserName, searchCondition.WorkTime, searchCondition.Month, (OrderedDictionary)newValues, (OrderedDictionary)oldValues);
            gvShowUsersBind();
        }
        protected void gvShowUsers_RowEditing(object sender, GridViewEditEventArgs e)
        {
            //输入的应该为数值,不能为字母等
            // Handle the new and original values.
            GridViewRow row = gvShowUsers.Rows[e.NewEditIndex];

            String workTime = row.Cells[2].Text;
            //在此处需过滤一些数据,比如不能够 修改WorkTime为“总计”的数据
            if (workTime == "总计")
            {
                lblMessage.Text = "不能修改“总计”项!";
                e.Cancel = true;

            }
            else
            {
                lblMessage.Text = "";
                searchCondition = new SearchCondition();
                searchCondition.Department = System.Configuration.ConfigurationManager.AppSettings["Department"];
                searchCondition.UserName = row.Cells[1].Text;
                searchCondition.Year = row.Cells[3].Text;
                var workTimeDic = new BindXML().BindWorkTime();
                string workTimeKey = " ";
                bool findWorkKey = workTimeDic.TryGetValue(row.Cells[2].Text, out workTimeKey);
                searchCondition.WorkTime = workTimeKey; //需改成WorkTime的格式
                var monthDic = new BindXML().BindMonths();
                string month = " ";
                bool findMonth = monthDic.TryGetValue(row.Cells[4].Text, out month);
                searchCondition.Month = month;  //需改成月的格式
                gvShowUsersBind();
            }
        }