protected void chk_CheckedChanged(object sender, EventArgs e) { foreach (GridViewRow row in grdFixData.Rows) { bool check = !((CheckBox)row.Cells[0].FindControl("chk")).Checked; } List <ATTFixedHoliday> LSTFx = (List <ATTFixedHoliday>)Session["FxHoliday"]; List <ATTAnnualHoliday> LSTAnl = (List <ATTAnnualHoliday>)Session["AnnPrevHoliday"]; List <ATTFixedHoliday> LSTFxChkd = new List <ATTFixedHoliday>(); foreach (GridViewRow rw in this.grdFixData.Rows) { ATTFixedHoliday objFxChkd = new ATTFixedHoliday(); if (((CheckBox)rw.FindControl("chk")).Checked == true) { objFxChkd.HolidayDescription = rw.Cells[6].Text; LSTFxChkd.Add(objFxChkd); } } foreach (ATTFixedHoliday var in LSTFxChkd) { int index = LSTAnl.FindIndex(delegate(ATTAnnualHoliday obj) { return(obj.HolidayDescription == var.HolidayDescription); } ); if (index >= 0) { ((CheckBox)grdPrevData.Rows[index].FindControl("chk1")).Checked = false; } } }
public static List <ATTFixedHoliday> GetFixedHolidays() { List <ATTFixedHoliday> LSTFxHolidays = new List <ATTFixedHoliday>(); try { foreach (DataRow row in DLLFixedHoliday.GetFixedHolidays().Rows) { ATTFixedHoliday obj = new ATTFixedHoliday(); obj.FromMonth = row["FROM_MONTH"].ToString(); obj.ToMonth = row["TO_MONTH"].ToString(); obj.FromDay = row["FROM_DAY"].ToString(); obj.ToDay = row["TO_DAY"].ToString(); obj.DateType = row["DATE_TYPE"].ToString(); obj.HolidayDescription = row["HOLIDAY_DESC"].ToString(); obj.Action = ""; LSTFxHolidays.Add(obj); } return(LSTFxHolidays); } catch (Exception ex) { throw ex; } }
public static List <ATTFixedHoliday> GetYear() { List <ATTFixedHoliday> LSTYear = new List <ATTFixedHoliday>(); try { foreach (DataRow rw in DLLFixedHoliday.GetYear().Rows) { ATTFixedHoliday obj = new ATTFixedHoliday(); obj.Year = rw["NYEAR"].ToString(); LSTYear.Add(obj); } return(LSTYear); } catch (Exception ex) { throw ex; } }
protected void btnFixedAdd_Click(object sender, EventArgs e) { string msg = EmptyMessageValidation("fx"); List <ATTFixedHoliday> LSTFix = (List <ATTFixedHoliday>)Session["FxHoliday"]; if (msg == "") { int frmMonth = int.Parse(this.txtFxFromMonth.Text); int toMonth = int.Parse(this.txtFxToMonth.Text); int fromDay = int.Parse(this.txtFxFromDay.Text); int toDay = int.Parse(this.txtFxToDay.Text); if (toMonth < frmMonth) { this.lblStatusMessage.Text = "**मिति सच्याउनुहोस्\n** देखि माहिना कम भयो"; this.programmaticModalPopup.Show(); this.txtFxToMonth.Text = ""; this.txtFxToMonth.Focus(); return; } if (toDay < fromDay) { this.lblStatusMessage.Text = "**मिति सच्याउनुहोस्\n** देखि दिन कम भयो"; this.programmaticModalPopup.Show(); this.txtFxToDay.Text = ""; this.txtFxToDay.Focus(); return; } ATTFixedHoliday objFix = new ATTFixedHoliday(); objFix.FromMonth = this.txtFxFromMonth.Text.Trim(); objFix.ToMonth = this.txtFxToMonth.Text.Trim(); objFix.FromDay = this.txtFxFromDay.Text.Trim(); objFix.ToDay = this.txtFxToDay.Text.Trim(); objFix.DateType = this.rdoFixDateType.SelectedValue.ToString(); objFix.HolidayDescription = this.txtFixDescription.Text.Trim(); //objFix.Year = this.ddlYear.SelectedValue.ToString(); objFix.EntryBy = Session["UserName"].ToString(); objFix.Action = "A"; foreach (GridViewRow row in this.grdFixData.Rows) { if (this.txtFxFromMonth.Text == row.Cells[0].Text && this.txtFxFromDay.Text == row.Cells[2].Text && this.txtFxToMonth.Text == row.Cells[1].Text && this.txtFxToDay.Text == row.Cells[3].Text && this.txtFixDescription.Text == row.Cells[5].Text) { this.lblStatusMessage.Text = "**बिदा पहिले नै छ"; this.programmaticModalPopup.Show(); ClearControls("Submit"); return; } } LSTFix.Add(objFix); this.grdFixData.DataSource = LSTFix; this.grdFixData.DataBind(); this.grdFixData.SelectedIndex = -1; Session["FixedHoliday"] = LSTFix; ClearControls("Submit"); } else { this.lblStatusMessage.Text = msg; this.programmaticModalPopup.Show(); return; } }