private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID)); Promo clsPromo = new Promo(); PromoDetails clsDetails = clsPromo.Details(iID); clsPromo.CommitAndDispose(); lblPromoID.Text = clsDetails.PromoID.ToString(); txtPromoCode.Text = clsDetails.PromoCode; txtPromoName.Text = clsDetails.PromoName; txtStartDate.Text = clsDetails.StartDate.ToString("yyyy-MM-dd HH:mm"); txtEndDate.Text = clsDetails.EndDate.ToString("yyyy-MM-dd HH:mm"); txtPromoType.Text = clsDetails.PromoTypeName; if (clsDetails.PromoTypeID == 1) { chkInPercentage.Checked = false; } else if (clsDetails.PromoTypeID == 2) { chkInPercentage.Checked = true; } LoadList(); }
private bool DeActivate() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { Promo clsPromo = new Promo(); clsPromo.DeActivate( stIDs.Substring(0,stIDs.Length-1)); clsPromo.CommitAndDispose(); } return boRetValue; }
private Int64 SaveRecord() { long lngRetValue = 0; string stScript = string.Empty; DateTime dteStartDateTime = DateTime.MinValue; try { dteStartDateTime = Convert.ToDateTime(txtStartDate.Text + " " + txtStartTime.Text); } catch { stScript += "<Script>"; stScript += "window.alert('Please enter a valid start date time of promo.')"; stScript += "</Script>"; Response.Write(stScript); return lngRetValue ; } DateTime dteEndDateTime = DateTime.MinValue; try { dteEndDateTime = Convert.ToDateTime(txtEndDate.Text + " " + txtEndTime.Text); } catch { stScript += "<Script>"; stScript += "window.alert('Please enter a valid end date time of promo.')"; stScript += "</Script>"; Response.Write(stScript); return lngRetValue; } Promo clsPromo = new Promo(); PromoDetails clsDetails = new PromoDetails(); clsDetails.PromoCode = txtPromoCode.Text; clsDetails.PromoName = txtPromoName.Text; clsDetails.StartDate = dteStartDateTime; clsDetails.EndDate = dteEndDateTime; clsDetails.PromoTypeID = Convert.ToInt32(cboPromoType.SelectedItem.Value); lngRetValue = clsPromo.Insert(clsDetails); clsPromo.CommitAndDispose(); return lngRetValue; }
private void LoadList() { Promo clsPromo = new Promo(); DataClass clsDataClass = new DataClass(); string SortField = "PromoName"; if (Request.QueryString["sortfield"]!=null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"]!=null) { sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } PromoDetails clsSearchKey = new PromoDetails(); if (Request.QueryString["Search"]!=null) { clsSearchKey.PromoCode = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); } PageData.DataSource = clsPromo.ListAstDataTable(clsSearchKey, SortField, sortoption).DefaultView; clsPromo.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]) ; PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i=0; i < PageData.PageCount;i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true;} else { cboCurrentPage.Items[i].Selected = false;} } lblDataCount.Text = " of " + " " + PageData.PageCount; }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID)); Promo clsPromo = new Promo(); PromoDetails clsDetails = clsPromo.Details(iID); clsPromo.CommitAndDispose(); lblPromoID.Text = clsDetails.PromoID.ToString(); txtPromoCode.Text = clsDetails.PromoCode; txtPromoName.Text = clsDetails.PromoName; txtStartDate.Text = clsDetails.StartDate.ToString("yyyy-MM-dd"); txtStartTime.Text = clsDetails.StartDate.ToString("HH:mm"); txtEndDate.Text = clsDetails.EndDate.ToString("yyyy-MM-dd"); txtEndTime.Text = clsDetails.EndDate.ToString("HH:mm"); cboPromoType.SelectedIndex = cboPromoType.Items.IndexOf(cboPromoType.Items.FindByValue(clsDetails.PromoTypeID.ToString())); }