protected void Customergrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { string name, email, id, phone, address, person; int CustomerId; id = Convert.ToString(Customergrdvw.Rows[e.RowIndex].Cells[0].Text); name = ((TextBox)Customergrdvw.Rows[e.RowIndex].Cells[1].Controls[0].FindControl("txtCustomername1")).Text; address = ((TextBox)Customergrdvw.Rows[e.RowIndex].Cells[2].Controls[0].FindControl("txtaddress1")).Text; email = ((TextBox)Customergrdvw.Rows[e.RowIndex].Cells[3].Controls[0].FindControl("txtemail1")).Text; phone = ((TextBox)Customergrdvw.Rows[e.RowIndex].Cells[4].Controls[0].FindControl("txtphone1")).Text; person = ((TextBox)Customergrdvw.Rows[e.RowIndex].Cells[5].Controls[0].FindControl("txtperson1")).Text; CustomerId = Convert.ToInt32(id); int count = Convert.ToInt32(ObjCustomer.Get_Customer_By_Custid(name)); ObjCustomer = ObjCustomer.Get_By_id(CustomerId); if (name == "") { lblerrmsg.Text = "Customer Name should not be Empty"; } else if (count == 0) { ObjCustomer.Customer_name = name; ObjCustomer.Address = address; ObjCustomer.Emailid = email; ObjCustomer.Contact_no = phone; ObjCustomer.Contact_person = person; ObjCustomer.Update(); Customergrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate; } else if (ObjCustomer.Customer_name == name) { ObjCustomer.Customer_name = name; ObjCustomer.Address = address; ObjCustomer.Emailid = email; ObjCustomer.Contact_no = phone; ObjCustomer.Contact_person = person; ObjCustomer.Update(); Customergrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate; } else { Customergrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.erralready.ToString(); } }
protected void grdvwRequest_RowDataBound(Object sender, GridViewRowEventArgs e) { System.Drawing.ColorConverter colConvert = new ColorConverter(); BLLCollection <ColorScheme_mst> colColor = new BLLCollection <ColorScheme_mst>(); if (e.Row.RowType == DataControlRowType.DataRow) { #region Autogenerate Serial number Label lblSerial = (Label)e.Row.FindControl("lblSerial"); lblSerial.Text = i.ToString(); i++; #endregion int TotalTimeSpentonCall; int TotalResolutionTime; int varIncidentid = Convert.ToInt16(((Label)e.Row.FindControl("incidentid")).Text.ToString()); string varCreateDatetime = e.Row.Cells[9].Text; string varStatusOpen = Resources.MessageResource.strStatusOpen.ToString(); string varStatusClose = Resources.MessageResource.strStatusClose.ToString(); string varStatusOnHold = Resources.MessageResource.strStatusOnHold.ToString(); string varStatusResolved = Resources.MessageResource.strStatusResolved.ToString(); #region Bind Data Row at Run time with requesterid to Requester name int requesterid = Convert.ToInt16(e.Row.Cells[3].Text); objUser = objUser.Get_By_id(requesterid); if (objUser.Userid != 0) { e.Row.Cells[3].Text = objUser.Username.ToString(); } else { e.Row.Cells[3].Text = ""; } #endregion #region Bind Datarow at Run Time with Createdbyid to Created by name int createdbyid = Convert.ToInt16(e.Row.Cells[4].Text); objUser = objUser.Get_By_id(createdbyid); if (objUser.Userid != 0) { e.Row.Cells[4].Text = objUser.Username.ToString(); } else { e.Row.Cells[4].Text = ""; } #endregion #region Bind Datarow at Run Time with technicianid to technician name int technicianid = Convert.ToInt16(e.Row.Cells[5].Text); objUser = objUser.Get_By_id(technicianid); if (objUser.Userid != 0) { e.Row.Cells[5].Text = objUser.Username.ToString(); } else { e.Row.Cells[5].Text = ""; } #endregion #region Bind Datarow at run time with Statusid to Status int statusid = Convert.ToInt16(e.Row.Cells[6].Text); objStatus = objStatus.Get_By_id(statusid); if (objStatus.Statusid != 0) { e.Row.Cells[6].Text = objStatus.Statusname.ToString(); } else { e.Row.Cells[6].Text = ""; } #endregion #region Bind Datarow at run time with Priorityid to Priority int priorityid = Convert.ToInt16(e.Row.Cells[7].Text); objPriority = objPriority.Get_By_id(priorityid); if (objPriority.Priorityid != 0) { e.Row.Cells[7].Text = objPriority.Name.ToString(); } else { e.Row.Cells[7].Text = ""; } #endregion #region Bind Datarow at run time with Siteid to Site int siteid = Convert.ToInt16(e.Row.Cells[8].Text); objSite = objSite.Get_By_id(siteid); if (objSite.Siteid != 0) { string custSiteName; int custid = 0; colCustToSite = objCustToSite.Get_All_By_siteid(objSite.Siteid); foreach (CustomerToSiteMapping objCuToSite in colCustToSite) { custid = objCuToSite.Custid; } objCustomer = objCustomer.Get_By_id(custid); e.Row.Cells[8].Text = objCustomer.Customer_name + "/" + objSite.Sitename.ToString(); } else { e.Row.Cells[8].Text = ""; } #endregion #region Apply Color Coding to Open Calls,According to define SLA if (varStatusOpen.ToLower() == objStatus.Statusname.ToString().ToLower()) { Incident_mst obj = new Incident_mst(); obj = obj.Get_By_id(varIncidentid); if (obj.Incidentid != 0) { if (obj.Slaid != 0) { #region Declare local variables,and objects of various classes int percent; ProcessEscalateEmail objPro = new ProcessEscalateEmail(); #endregion #region Get Total Resolution time define for particular SLA and Time Spent on Request TotalResolutionTime = objPro.GetResolutionTimeInMins(obj.Slaid); TotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(varIncidentid, siteid, varCreateDatetime, DateTime.Now.ToString()); if (TotalTimeSpentonCall < 0) { TotalTimeSpentonCall = 0; } #endregion #region Calculate Percent percent = (TotalTimeSpentonCall * 100) / TotalResolutionTime; #endregion ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusOpen); foreach (ColorScheme_mst objCol in colColor) { if (objCol.Percnt_to != 0) { if (percent >= objCol.Percnt && percent <= objCol.Percnt_to) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } else { if (percent >= objCol.Percnt) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } } } else { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus("NonSLA"); foreach (ColorScheme_mst objCol in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } } } #endregion #region Apply Color Coding to Close Calls if (varStatusClose.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusClose); foreach (ColorScheme_mst obj in colColor) { try { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } catch (Exception ex) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("White"); } } } #endregion #region Apply Color Coding to On Hold Calls if (varStatusOnHold.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusOnHold); foreach (ColorScheme_mst obj in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } } #endregion #region Apply Color Coding to Resolved Calls if (varStatusResolved.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusResolved); foreach (ColorScheme_mst obj in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } } #endregion } }
//Added by Lalit public void BindDropCustomer() { BLLCollection <Customer_mst> colCtS = new BLLCollection <Customer_mst>(); string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { int userid; int Flagcount = 0; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; colUserToSite = ObjUserToSite.Get_All_By_userid(userid); foreach (UserToSiteMapping obj in colUserToSite) { int siteid; Site_mst objSite1 = new Site_mst(); siteid = obj.Siteid; objSite1 = objSite1.Get_By_id(siteid); if (objSite1.Siteid != 0) { colCustToSite = objCustToSite.Get_All_By_siteid(objSite1.Siteid); foreach (CustomerToSiteMapping objcts in colCustToSite) { Customer_mst objC = new Customer_mst(); int FlagStatus = 0; objC = objC.Get_By_id(objcts.Custid); if (Flagcount == 0) { colCtS.Add(objC); } else { foreach (Customer_mst objCus in colCtS) { if (objC.Custid == objCus.Custid) { FlagStatus = 1; } } if (FlagStatus == 0) { colCtS.Add(objC); } } Flagcount = Flagcount + 1; } } } } //} //DdlStock.DataBind(); // DdlOwner.DataTextField = "Customer_Name"; // DdlOwner.DataValueField = "CustId"; // DdlOwner.DataSource = colCtS; // DdlOwner.DataBind(); //if (colCtS.Count == 0) //{ ListItem item = new ListItem(); item.Text = "Other"; //item.Value = "1"; // DdlOwner.Items.Add(item); //} } }
public void BindDropCustomer() { //colCust = objCustomer.Get_All(); //drpCustomer.DataTextField = "Customer_Name"; //drpCustomer.DataValueField = "CustId"; //drpCustomer.DataSource = colCust; //drpCustomer.DataBind(); //ListItem item = new ListItem(); //item.Text = "------------Select-------------"; //item.Value = "0"; //drpCustomer.Items.Add(item); //drpCustomer.SelectedValue = "0"; BLLCollection<Customer_mst> colCtS = new BLLCollection<Customer_mst>(); string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); } if (userName != "") { int userid; int Flagcount = 0; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; colUserToSite = ObjUserToSite.Get_All_By_userid(userid); foreach (UserToSiteMapping obj in colUserToSite) { int siteid; Site_mst objSite1 = new Site_mst(); siteid = obj.Siteid; objSite1 = objSite1.Get_By_id(siteid); if (objSite1.Siteid != 0) { colCustToSite = objCustToSite.Get_All_By_siteid(objSite1.Siteid); foreach (CustomerToSiteMapping objcts in colCustToSite) { Customer_mst objC = new Customer_mst(); int FlagStatus = 0; objC = objC.Get_By_id(objcts.Custid); if (Flagcount == 0) { colCtS.Add(objC); } else { foreach (Customer_mst objCus in colCtS) { if (objC.Custid == objCus.Custid) { FlagStatus = 1; } } if (FlagStatus == 0) { colCtS.Add(objC); } } Flagcount = Flagcount + 1; } } } } } drpCustomer.DataTextField = "Customer_Name"; drpCustomer.DataValueField = "CustId"; drpCustomer.DataSource = colCtS; drpCustomer.DataBind(); if (colCtS.Count == 0) { ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpCustomer.Items.Add(item); } }