private void DoSearchRanking(string rankingId) { RankingData ranking = RankingBiz.SearchRankingData(rankingId); hidRankingId.Value = ranking.coc_RankingId.ToString(); txtSeq.Text = ranking.coc_Seq.ToString(); if (ranking.coc_Name != null) { txtName.Text = ranking.coc_Name.ToString(); } txtSkip.Text = ranking.coc_SkipDate.ToString(); if (ranking.coc_IsAllDealer == null || ranking.coc_IsAllDealer == "" || ranking.coc_IsAllDealer == "N") { chkAllDealer.Checked = false; } else { chkAllDealer.Checked = true; } if (ranking.coc_Seq == 1) { trSkip.Visible = true; divEdit.Visible = false; trAdd.Visible = true; } else { trSkip.Visible = false; } }
protected void btnSaveRanking_Click(object sender, EventArgs e) { try { int[] RankingIds = (from p in Request.Form["RankingId"].Split(',') select int.Parse(p)).ToArray(); int preference = 0; List <RankingData> rankingdatas = new List <RankingData>(); foreach (int RankingId in RankingIds) { RankingData rankingdata = new RankingData(); rankingdata.coc_RankingId = RankingId; rankingdata.coc_Seq = preference += 1; rankingdatas.Add(rankingdata); } RankingBiz.UpdateSeq(rankingdatas, HttpContext.Current.User.Identity.Name); DoSearchRankingData(0); //btnSaveRanking.Visible = false; //btnCancel.Visible = false; //btnEdit.Visible = true; } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
private void InitialControl() { AppUtil.SetIntTextBox(txtSkip); if (Request.QueryString["rankingid"] == null) { divEdit.Visible = true; trAdd.Visible = false; trSkip.Visible = false; btnDeleteAll.Visible = false; } else { divEdit.Visible = true; trAdd.Visible = false; DoSearchRanking(Request.QueryString["rankingid"]); if (RankingBiz.isLastRankingData(Request.QueryString["rankingid"])) { upResultCampaign.Visible = false; upResultDealer.Visible = false; } DoSearchCampaign(0); DoSearchDealer(0); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (ValidateData()) { RankingData data = new RankingData(); data.coc_Name = txtName.Text; if (hidRankingId.Value == "") { int rankingId = RankingBiz.AddRanking(data, (List <RankingCampaignData>)ViewState["Campaign"], (List <RankingDealerData>)ViewState["Dealer"], HttpContext.Current.User.Identity.Name); Session[ss_rankingid] = rankingId; } else { RankingBiz.EditRanking(data, null, null, HttpContext.Current.User.Identity.Name); } AppUtil.ClientAlertAndRedirect(Page, "บันทึกข้อมูล Ranking สำเร็จ", "COC_SCR_101.aspx"); } else { AppUtil.ClientAlert(Page, "กรุณาระบุข้อมูลให้ครบถ้วน"); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
//protected void btnEdit_Click(object sender, EventArgs e) //{ // btnSaveRanking.Visible = true; // btnCancel.Visible = true; //} //protected void btnCancel_Click(object sender, EventArgs e) //{ // DoSearchRankingData(); // btnSaveRanking.Visible = false; // btnCancel.Visible = false; //} //protected void PageSearchChange(object sender, EventArgs e) //{ // try // { // var pageControl = (SLM.Application.Shared.GridviewPageController)sender; // DoSearchLeadData(pageControl.SelectedPageIndex, SortExpressionProperty, SortDirectionProperty); // } // catch (Exception ex) // { // string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; // _log.Debug(message); // AppUtil.ClientAlert(Page, message); // } //} #endregion //protected void lbSaleTool_Click(object sender, EventArgs e) //{ // int index = int.Parse(((LinkButton)sender).CommandArgument); // string ticketid = ((ImageButton)gvResult.Rows[index].FindControl("imbView")).CommandArgument; // string username = HttpContext.Current.User.Identity.Name; // string saleToolHost = System.Configuration.ConfigurationManager.AppSettings["SaleToolHost"].ToString(); // WebRequest request = WebRequest.Create("http://" + saleToolHost + "/saletool/default.aspx"); // request.Method = "POST"; // request.ContentType = "application/x-www-form-urlencoded"; // //ASCIIEncoding encoding = new ASCIIEncoding(); // //byte[] data = encoding.GetBytes(postData); // string postData = "ticketid=" + ticketid + "&username="******"SortingState"] == null) // { // ViewState["SortingState"] = SortDirection.Ascending; // } // return (SortDirection)ViewState["SortingState"]; // } // set // { // ViewState["SortingState"] = value; // } //} //public string SortExpressionProperty //{ // get // { // if (ViewState["ExpressionState"] == null) // { // ViewState["ExpressionState"] = string.Empty; // } // return ViewState["ExpressionState"].ToString(); // } // set // { // ViewState["ExpressionState"] = value; // } //} #endregion //protected void cbOptionAll_CheckedChanged(object sender, EventArgs e) //{ // if (cbOptionAll.Checked) // { // foreach (ListItem li in cbOptionList.Items) // { // li.Selected = true; // } // } // else // { // foreach (ListItem li in cbOptionList.Items) // { // li.Selected = false; // } // } //} //protected void cbOptionList_SelectedIndexChanged(object sender, EventArgs e) //{ // CheckAllCondition(); //} //private void CheckAllCondition() //{ // int count = 0; // foreach (ListItem li in cbOptionList.Items) // { // if (!li.Selected) { count += 1; } // } // cbOptionAll.Checked = count > 0 ? false : true; //} protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (RankingBiz.isLastRankingData(((SearchRankingResult)e.Row.DataItem).coc_RankingId.ToString())) { ((ImageButton)e.Row.FindControl("imbEdit")).Visible = false; } else { ((ImageButton)e.Row.FindControl("imbEdit")).Visible = true; } } }
private void DoSearchRankingData(int pageIndex = 0)//, string sortExpression, SortDirection sortDirection) { try { string orderByFlag = ""; List <SearchRankingResult> result = RankingBiz.SearchRankingData(); BindGridview(result.ToArray(), pageIndex); //(SLM.Application.Shared.GridviewPageController)pcTop, upResult.Update(); } catch (Exception ex) { throw ex; } }
protected void btnDeleteAll_Click(object sender, EventArgs e) { try { if (RankingBiz.CheckDeleteRanking(hidRankingId.Value)) { RankingBiz.DeleteRanking(AppUtil.SafeInt(hidRankingId.Value), HttpContext.Current.User.Identity.Name); AppUtil.ClientAlertAndRedirect(Page, "บันทึกข้อมูล Ranking สำเร็จ", "COC_SCR_101.aspx"); } else { AppUtil.ClientAlert(Page, "ข้อมูลที่เลือกไม่สามารถลบได้"); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Debug(message); AppUtil.ClientAlert(Page, message); } }
private bool ValidateData() { int i = 0; //************************************Windows Username******************************************** if (txtName.Text.Trim() == "") { vtxtName.Text = "กรุณาระบุชื่อลำดับที่"; vtxtName.ForeColor = System.Drawing.Color.Red; i += 1; } else { vtxtName.Text = ""; //if (SlmScr019Biz.CheckUsernameExist(txtUserName.Text.Trim(), null)) if (RankingBiz.CheckNameExist(txtName.Text.Trim(), AppUtil.SafeInt(hidRankingId.Value))) { vtxtName.Text = "ชื่อลำดับที่นี้มีอยู่แล้วในระบบแล้ว"; vtxtName.ForeColor = System.Drawing.Color.Red; i += 1; } else { vtxtName.Text = ""; } } if (i > 0) { return(false); } else { return(true); } }