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(); } }
public static List <ATTTippaniChannel> GetTippaniChannelList(int?orgID, int?tippaniSubjectID) { List <ATTTippaniChannel> lst = new List <ATTTippaniChannel>(); try { DataTable tbl = DLLTippaniChannel.GetTippaniChannel(orgID, tippaniSubjectID); foreach (DataRow row in tbl.Rows) { ATTTippaniChannel channel = new ATTTippaniChannel(); channel.ChannelSeqID = int.Parse(row["channel_seq_id"].ToString()); channel.OTOrgID = int.Parse(row["ot_org_id"].ToString()); channel.TippaniSubjectID = int.Parse(row["tippani_subject_id"].ToString()); channel.ChannelPersonID = double.Parse(row["emp_id"].ToString()); channel.OTFromDate = row["OT_FROM_DATE"].ToString(); channel.FromDate = row["tc_from_date"].ToString(); channel.ToDate = ""; channel.ChannelPersonOrder = int.Parse(row["channel_person_order"].ToString()); channel.ChannelPersonType = row["channel_person_type"].ToString(); channel.IsFinalApprover = row["is_final_approver"].ToString() == "Y" ? true : false; channel.ChannelPersonName = row["p_name"].ToString(); channel.OrgName = row["org_name"].ToString(); channel.DegName = row["des_name"].ToString(); channel.CommitteeName = row["group_name"].ToString(); channel.PostName = row["position_name"].ToString(); channel.OrgID = int.Parse(row["org_id"].ToString()); channel.DesID = int.Parse(row["des_id"].ToString()); channel.CreatedDate = row["created_date"].ToString(); channel.PostID = int.Parse(row["post_id"].ToString()); channel.PostFromDate = row["from_date"].ToString(); channel.OrgID = int.Parse(row["org_id"].ToString()); channel.UnitID = int.Parse(row["org_unit_id"].ToString()); channel.UnitName = row["unit_name"].ToString(); channel.UnitFromDate = row["unit_from_date"].ToString(); channel.UnitOrgID = int.Parse(row["org_id"].ToString()); channel.Action = "N"; //channel.OrgID = int.Parse(row["tc_org_id"].ToString()); //channel.TippaniSubjectID = int.Parse(row["tippani_subject_id"].ToString()); //channel.ChannelPersonID = double.Parse(row["channel_person_id"].ToString()); //channel.ChannelPersonName = row["p_name"].ToString(); //channel.OrgName = row["org_name"].ToString(); //channel.CommitteeName = row["group_name"].ToString(); //channel.PostName = row["position_name"].ToString(); //channel.FromDate = row["from_date"].ToString(); //channel.ChannelPersonOrder = int.Parse(row["channel_person_order"].ToString()); //channel.ChannelPersonType = row["channel_person_type"].ToString(); //channel.IsFinalApprover = row["is_final_approver"].ToString() == "Y" ? true : false; //channel.OldValue = channel.FromDate + "|" + channel.ChannelPersonOrder + "|" + channel.ChannelPersonType + "|" + channel.IsFinalApprover.ToString(); //channel.Action = "N"; lst.Add(channel); } return(lst); } catch (Exception ex) { throw ex; } }