protected void btnSave_Click(object sender, EventArgs e)
 {
     if (null == Session["strSiteName"] || null == Session["strSiteCode"] || null == Session["strLoginName"])
     {
         Response.Write("<script language=JavaScript>;parent.location.href='../Index.aspx';</script>");
         Response.End();
     }
     if (txtName.Text.Trim() != null && txtName.Text.Trim() != "")
     {
         HD_HoliDay model = new HD_HoliDay();
         HoliDayDAL dal   = new HoliDayDAL();
         model.Htitle     = txtName.Text;
         model.HstartTime = Convert.ToDateTime(starttime.Text);
         model.HendTime   = Convert.ToDateTime(endtime.Text);
         model.Hcontent   = hd_content.Value;
         model.ID         = strID;
         model.Hisdel     = 0;
         model.SiteCode   = Session["strSiteCode"].ToString();
         if (dal.UpdateHoliday(model))
         {
             MessageBox.Show(this, "操作成功!");
         }
         else
         {
             MessageBox.Show(this, "操作失败!");
         }
     }
     else
     {
         MessageBox.Show(this, "请输入相关名称!");
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (null != Common.Common.NoHtml(Request.QueryString["action"]))
            {
                strAction = Common.Common.NoHtml(Request.QueryString["action"]);
            }
            if (null != Common.Common.NoHtml(Request.QueryString["id"]))
            {
                strID = Common.Common.NoHtml(Request.QueryString["id"]);
            }
            HoliDayDAL dal = new HoliDayDAL();

            switch (strAction)
            {
            case "del":
                if (dal.UpdateHolidayState(strID))
                {
                    strMessage = "操作成功!";
                }
                else
                {
                    strMessage = "操作失败!";
                }
                break;

            default:
                break;
            }
            Response.Write(strMessage);
            Response.End();
        }
Пример #3
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="strWhere">条件</param>
        void LoadData(string strWhere)
        {
            HoliDayDAL holidayDal = new HoliDayDAL();
            DataSet    ds         = holidayDal.GetHoliDayList(strWhere);
            DataView   dv         = ds.Tables[0].DefaultView;

            AspNetPager1.RecordCount = dv.Count;

            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = dv;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;
            Repeater1.DataSource = pds;
            Repeater1.DataBind();
        }
Пример #4
0
 /// <summary>
 /// 获取活动详细
 /// </summary>
 void GetHolidayDetail()
 {
     if (strID.Trim() != null && strID.Trim() != "")
     {
         HoliDayDAL holidaydal = new HoliDayDAL();
         HD_HoliDay holidaymodel = new HD_HoliDay();
         DataSet    ds = holidaydal.GetHoliDayDateil(strID);
         string     starttime = string.Empty; string endtime = string.Empty;
         if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
         {
             holidaymodel = DataConvert.DataRowToModel <HD_HoliDay>(ds.Tables[0].Rows[0]);
         }
         if (holidaymodel.HstartTime < DateTime.Now)
         {
             starttime = holidaymodel.HstartTime.ToString();
         }
         else
         {
             starttime = "";
         }
         if (holidaymodel.HendTime < DateTime.Now)
         {
             endtime = "";
         }
         else
         {
             endtime = holidaymodel.HendTime.ToString();
         }
         //读取模板内容
         string text = string.Empty;
         text = System.IO.File.ReadAllText(Server.MapPath("Themes/HoliDay/HolidayRsg.html"));
         JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
         context.TempData["title"]         = "活动详细信息";
         context.TempData["holidayDetail"] = holidaymodel;
         context.TempData["starttime"]     = starttime;
         context.TempData["endtime"]       = endtime;
         context.TempData["sitecode"]      = strSiteCode;
         context.TempData["hid"]           = strID;
         context.TempData["footer"]        = "奥琦微商易";
         JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
         t.Render(Response.Output);
     }
 }
Пример #5
0
        const string vsKey = "searchCriteria"; //ViewState key
        /// <summary>
        /// 页面加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlHolidayList.Items.Clear();
                HoliDayDAL Holdaydal = new HoliDayDAL();
                DataSet    ds        = new DataSet();
                if (Session["strRoleCode"].ToString() == "ADMIN")
                {
                    ds = Holdaydal.GetHoliDayList("");
                }
                else
                {
                    ds = Holdaydal.GetHoliDayList("  AND SiteCode ='" + Session["strSiteCode"].ToString() + "' ");
                }
                DataTable dt = ds.Tables[0];

                DataRow dr = ds.Tables[0].NewRow();
                dr["ID"]     = 0;
                dr["Htitle"] = "--全部--";
                dt.Rows.InsertAt(dr, 0);

                ddlHolidayList.DataSource     = ds.Tables[0].DefaultView;
                ddlHolidayList.DataTextField  = "Htitle";
                ddlHolidayList.DataValueField = "ID";
                ddlHolidayList.DataBind();

                AspNetPager1.CurrentPageIndex = 1;
                string s = "";
                if (Session["strRoleCode"].ToString() != "ADMIN")
                {
                    s = " AND b.SiteCode = '" + Session["strSiteCode"].ToString() + "' ";
                }
                ViewState[vsKey] = s;
                LoadData(s);
            }
        }
        public void ShowActivityInfo(string strID)
        {
            HoliDayDAL dal   = new HoliDayDAL();
            DataSet    ds    = dal.GetHoliDayDateil(strID);
            HD_HoliDay model = DataConvert.DataRowToModel <HD_HoliDay>(ds.Tables[0].Rows[0]);

            txtName.Text     = model.Htitle;
            hd_content.Value = model.Hcontent;
            starttime.Text   = model.HstartTime.ToString();
            endtime.Text     = model.HendTime.ToString();
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
                starttime.ReadOnly    = true;
                endtime.ReadOnly      = true;
                txtName.ReadOnly      = true;
            }
            else
            {
                starttime.Attributes.Add("onclick", "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})");
                endtime.Attributes.Add("onclick", "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})");
            }
        }