protected void btnSubmit_Click(object sender, EventArgs e) { if (this.lstTippaniSubject.SelectedIndex < 0) { this.lblStatusMessage.Text = "Please select any Tippani Subject from list"; this.programmaticModalPopup.Show(); return; } ATTOrganizationTippaniSubject tippani = (ATTOrganizationTippaniSubject)Session["TempTippaniSubject"]; List <ATTTippaniChannel> lst = tippani.LstTippaniChannel; int index = 0; foreach (GridViewRow row in this.grdChannelPerson.Rows) { lst[index].FromDate = ((TextBox)row.FindControl("txtFromDate_Rdt")).Text; lst[index].ChannelPersonOrder = int.Parse(((DropDownList)row.FindControl("ddlOrder_Rqd")).SelectedValue); lst[index].ChannelPersonType = ((DropDownList)row.FindControl("ddlType_Rqd")).SelectedValue; lst[index].IsFinalApprover = ((CheckBox)row.FindControl("chkApprover")).Checked; lst[index].ToDate = ""; if (lst[index].Action != "D") { if ( lst[index].NewValue == lst[index].OldValue && lst[index].Action != "A" ) { lst[index].Action = "N"; } else { if (lst[index].Action == "A") { lst[index].Action = "A"; } else { lst[index].Action = "E"; } } } index++; } try { BLLTippaniChannel.AddTippaniChannel(lst); lst.RemoveAll ( delegate(ATTTippaniChannel c) { return(c.Action == "D"); } ); List <ATTOrganizationTippaniSubject> orgLst = (List <ATTOrganizationTippaniSubject>)Session["TippaniSubjectLst"]; if (this.lstTippaniSubject.SelectedIndex < 0) { orgLst.Add(tippani); } else { orgLst[this.lstTippaniSubject.SelectedIndex] = tippani; } this.ClearME(); this.lblStatusMessage.Text = "Tippani Subject Channel saved successfully."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
protected void btnAddChannelPerson_Click(object sender, EventArgs e) { if (this.lstTippaniSubject.SelectedIndex < 0) { this.lblStatusMessage.Text = "Please select Tippani Subject from list."; this.programmaticModalPopup.Show(); return; } ATTOrganizationTippaniSubject tippani = (ATTOrganizationTippaniSubject)Session["TempTippaniSubject"]; List <ATTTippaniChannel> lst = tippani.LstTippaniChannel; tippani.TippaniSubjectID = int.Parse(this.lstTippaniSubject.SelectedValue); int index = 0; foreach (GridViewRow row in this.grdChannelPerson.Rows) { lst[index].FromDate = ((TextBox)row.FindControl("txtFromDate_Rdt")).Text; lst[index].ChannelPersonOrder = int.Parse(((DropDownList)row.FindControl("ddlOrder_Rqd")).SelectedValue); lst[index].ChannelPersonType = ((DropDownList)row.FindControl("ddlType_Rqd")).SelectedValue; lst[index].IsFinalApprover = ((CheckBox)row.FindControl("chkApprover")).Checked; lst[index].ToDate = ""; if (lst[index].Action != "D") { if ( lst[index].NewValue == lst[index].OldValue && lst[index].Action != "A" ) { lst[index].Action = "N"; } else { if (lst[index].Action == "A") { lst[index].Action = "A"; } else { lst[index].Action = "E"; } } } index++; } string namelist = ""; foreach (GridViewRow row in this.grdEmployee.Rows) { bool selected = ((CheckBox)row.FindControl("chkSelect")).Checked; if (selected == true) { ATTTippaniChannel channel = new ATTTippaniChannel(); //channel.OrgID = int.Parse(this.ddlTippaniOrg.SelectedValue); channel.ChannelSeqID = 0; channel.OTOrgID = ((List <ATTOrganizationTippaniSubject>)Session["TippaniSubjectLst"])[this.lstTippaniSubject.SelectedIndex].OrgID; channel.OTFromDate = ((List <ATTOrganizationTippaniSubject>)Session["TippaniSubjectLst"])[this.lstTippaniSubject.SelectedIndex].FromDate; channel.TippaniSubjectID = int.Parse(this.lstTippaniSubject.SelectedValue); channel.ChannelPersonID = double.Parse(row.Cells[1].Text); channel.FromDate = ""; channel.ToDate = ""; channel.ChannelPersonOrder = 0; channel.ChannelPersonType = "0"; channel.IsFinalApprover = false; channel.ChannelPersonName = row.Cells[2].Text; channel.OrgName = this.FilterText(row.Cells[7].Text); channel.DegName = this.FilterText(row.Cells[8].Text); channel.UnitID = int.Parse(row.Cells[15].Text); channel.UnitName = row.Cells[11].Text; channel.CommitteeName = this.FilterText(row.Cells[9].Text); channel.PostName = this.FilterText(row.Cells[10].Text); channel.OrgID = int.Parse(row.Cells[13].Text); channel.DesID = int.Parse(row.Cells[14].Text); channel.CreatedDate = row.Cells[16].Text; channel.PostID = int.Parse(row.Cells[17].Text); channel.PostFromDate = row.Cells[18].Text; channel.UnitFromDate = row.Cells[19].Text; channel.EntryBy = this.User.UserName; channel.Action = "A"; bool exist = tippani.LstTippaniChannel.Exists ( delegate(ATTTippaniChannel c) { return (c.TippaniSubjectID == channel.TippaniSubjectID && c.ChannelPersonID == channel.ChannelPersonID); } ); if (exist == false) { tippani.LstTippaniChannel.Add(channel); } else { namelist = namelist + "---- " + channel.ChannelPersonName + "<br>"; } ((CheckBox)row.FindControl("chkSelect")).Checked = false; } } this.grdChannelPerson.DataSource = tippani.LstTippaniChannel; this.grdChannelPerson.DataBind(); this.grdChannelPerson.Focus(); this.SetGridColor(12, 13, this.grdChannelPerson); if (namelist != string.Empty) { this.lblStatusMessage.Text = "Following person::<br><br>" + namelist + "<br> has been already added for this Tippani.<br>So these person cannot be added at this time."; this.programmaticModalPopup.Show(); } }