Esempio n. 1
0
        void GetOptionList()
        {
            string subid = string.Empty;

            if (Request["subid"] != null && Request["subid"] != "")
            {
                subid = Common.Common.NoHtml(Request["subid"]);
            }
            else
            {
                return;
            }
            if (subid.Trim() != null && subid.Trim() != "")
            {
                LuckyAwardDAL luckdal = new LuckyAwardDAL();
                DataSet       optionds;
                if (Session["strSiteCode"].ToString() == "ADMIN")
                {
                    optionds = luckdal.GetAwardList(" and a.ActID='" + subid + "' ");
                }
                else
                {
                    optionds = luckdal.GetAwardList(" and b.SiteCode='" + Session["strSiteCode"].ToString() +
                                                    "' and a.ActID='" + subid + "' ");
                }
                Response.Write(Dataset2Json(optionds));
            }
            else
            {
                Response.Write("{\"success\":\"操作失败\"}");
            }
            Response.End();
        }
        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"]);
            }

            LuckyAwardDAL dal = new LuckyAwardDAL();

            switch (strAction)
            {
            case "del":
                if (dal.UpdateAwardIsDel(strID))
                {
                    strMessage = "操作成功!";
                }
                else
                {
                    strMessage = "操作失败!";
                }
                break;
            }
            Response.Write(strMessage);
            Response.End();
        }
 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 (AwardName.Text.Trim() != null && AwardName.Text.Trim() != "")
     {
         LuckyAwardDAL dal         = new LuckyAwardDAL();
         string        strSiteCode = Session["strSiteCode"].ToString();
         if (dal.ExistAward(AwardName.Text, strSiteCode))
         {
             MessageBox.Show(this, "该奖项已经存在!");
         }
         else
         {
             LuckyAward model = new LuckyAward();
             model.Award        = AwardName.Text;
             model.AwardContent = hd_content.Value;
             model.ID           = Guid.NewGuid().ToString("N").ToUpper();
             if (AwardNum.Text.Trim() != null && AwardNum.Text.Trim() != "")
             {
                 model.AwardNum = Convert.ToInt32(AwardNum.Text);
             }
             if (AwardPro.Text.Trim() != null && AwardPro.Text.Trim() != "")
             {
                 model.AwardPro = Convert.ToInt32(AwardPro.Text);
             }
             if (ddlactlist.SelectedValue.Trim() != null && ddlactlist.SelectedValue.Trim() != "")
             {
                 model.ActID = ddlactlist.SelectedValue;
             }
             model.AwardSort = Convert.ToInt32(awardsort.SelectedValue);
             model.IsDel     = 0;
             if (dal.AddAward(model))
             {
                 MessageBox.Show(this, "操作成功!");
             }
             else
             {
                 MessageBox.Show(this, "操作失败!");
             }
         }
     }
     else
     {
         MessageBox.Show(this, "请输入相应标题名称!");
     }
 }
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="strWhere">条件</param>
        void LoadData(string strWhere)
        {
            txtName.Text = "";
            LuckyAwardDAL dal = new LuckyAwardDAL();
            DataSet       ds  = dal.GetAwardList(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();
        }
Esempio n. 5
0
        void ShowInfo(string strID)
        {
            LuckyAwardDAL dal   = new LuckyAwardDAL();
            DataSet       ds    = dal.GetAwardDetail(strID);
            LuckyAward    model = DataConvert.DataRowToModel <LuckyAward>(ds.Tables[0].Rows[0]);

            AwardName.Text           = model.Award;
            hd_content.Value         = model.AwardContent;
            AwardNum.Text            = model.AwardNum.ToString();
            ddlactlist.SelectedIndex = ddlactlist.Items.IndexOf(ddlactlist.Items.FindByValue(model.ActID));
            awardsort.SelectedIndex  = awardsort.Items.IndexOf(awardsort.Items.FindByValue(model.AwardSort.ToString()));
            AwardPro.Text            = model.AwardPro.ToString();
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }