Esempio n. 1
0
        protected void btnBuildCalendar_Click(object sender, EventArgs e)
        {
            BLL.tb_JC_WorkCalendarRule bllRule = new BLL.tb_JC_WorkCalendarRule();
            bllRule.BuildCalendar(DateTime.Today);
            //重新加载日历页面
            string script = string.Format("{0}.src='Calendar.aspx';", panelBottom.FindControl("calendar").ClientID);

            PageContext.RegisterStartupScript(script);
        }
Esempio n. 2
0
        private void BindGrid()
        {
            string strWhere  = "1=1";
            string order     = string.Format("{0} {1}", gridCalendarRule.SortField, gridCalendarRule.SortDirection);
            int    pageSize  = gridCalendarRule.PageSize;
            int    pageIndex = gridCalendarRule.PageIndex;
            long   totalRecord;

            BLL.tb_JC_WorkCalendarRule bllRule = new BLL.tb_JC_WorkCalendarRule();
            DataTable dtSource = bllRule.GetListByPage(strWhere, order, pageSize, pageIndex, out totalRecord).Tables[0];

            gridCalendarRule.DataSource  = dtSource;
            gridCalendarRule.RecordCount = (int)totalRecord;
            gridCalendarRule.DataBind();
        }
Esempio n. 3
0
 protected void gridCalendarRule_RowCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "ActionDel")
     {
         BLL.tb_JC_WorkCalendarRule bllRule = new BLL.tb_JC_WorkCalendarRule();
         bool result = bllRule.Delete(gridCalendarRule.DataKeys[e.RowIndex][0].ToString());
         if (result)
         {
             Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information);
         }
         else
         {
             Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error);
         }
     }
 }
Esempio n. 4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     #region 空值检测
     if ("C" == ddlExceptionType.SelectedValue)
     {
         Alert.ShowInTop("无有效设置", "警告", MessageBoxIcon.Warning);
         return;
     }
     if ("W" == ddlExceptionType.SelectedValue && ddlWeek.SelectedIndex < 1)
     {
         Alert.ShowInTop("请选择星期", "警告", MessageBoxIcon.Warning);
         return;
     }
     if ("D" == ddlExceptionType.SelectedValue && "" == nbxMonth.Text)
     {
         Alert.ShowInTop("请选择月份", "警告", MessageBoxIcon.Warning);
         return;
     }
     if ("D" == ddlExceptionType.SelectedValue && "" == nbxDay.Text)
     {
         Alert.ShowInTop("请选择日期", "警告", MessageBoxIcon.Warning);
         return;
     }
     if ("M" == ddlExceptionType.SelectedValue && "" == nbxMonth.Text)
     {
         Alert.ShowInTop("请选择月份", "警告", MessageBoxIcon.Warning);
         return;
     }
     #endregion
     #region 日期规则检测
     string[] month30 = { "4", "6", "9", "11" };
     if (month30.Contains(nbxMonth.Text) && int.Parse(nbxDay.Text) > 30)
     {
         Alert.ShowInTop(nbxDay.Text + "月共有30天!", "错误", MessageBoxIcon.Error);
     }
     if ("2" == nbxMonth.Text && int.Parse(nbxDay.Text) > 29)
     {
         Alert.ShowInTop("2月最多29天!", "错误", MessageBoxIcon.Error);
     }
     #endregion
     #region 保存
     Model.tb_JC_WorkCalendarRule modelRule = new Model.tb_JC_WorkCalendarRule();
     modelRule.ID            = Guid.NewGuid().ToString();
     modelRule.ExceptionType = ddlExceptionType.SelectedValue;
     if (ddlExceptionType.SelectedValue == "W")
     {
         modelRule.ExceptionTime = ddlWeek.SelectedValue;
     }
     else if (ddlExceptionType.SelectedValue == "M")
     {
         modelRule.ExceptionTime = nbxMonth.Text;
     }
     else
     {
         modelRule.ExceptionTime = string.Format("{0}-{1}", nbxMonth, nbxDay);
     }
     BLL.tb_JC_WorkCalendarRule bllRule = new BLL.tb_JC_WorkCalendarRule();
     bool result = bllRule.Add(modelRule);
     if (result)
     {
         Alert.ShowInTop("添加成功", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Add_Success"));
     }
     else
     {
         Alert.ShowInTop("添加失败", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Add_Fail"));
     }
     #endregion
 }