protected void Showvalues()
    {
        int incidentid = Convert.ToInt32(Session["incidentid"]);

        ObjIncident       = ObjIncident.Get_By_id(incidentid);
        ObjIncidentStates = ObjIncidentStates.Get_By_id(incidentid);
        // drpTechnician.SelectedValue = ObjIncidentStates.Technicianid.ToString();
        drpCategory.SelectedValue = ObjIncidentStates.Categoryid.ToString();
        BindDropSubCategory();
        drpSubcategory.SelectedValue = ObjIncidentStates.Subcategoryid.ToString();

        // drpPriority.SelectedValue = ObjIncidentStates.Priorityid.ToString();
        txtTitle.Text = ObjIncident.Title.ToString();
        if (ObjIncident.Description != null)
        {
            txtDescription.Text = ObjIncident.Description.ToString();
        }

        UserLogin_mst   objUsr  = new UserLogin_mst();
        ContactInfo_mst objInfo = new ContactInfo_mst();

        objInfo                 = objInfo.Get_By_id(ObjIncident.Requesterid);
        objUsr                  = objUsr.Get_By_id(ObjIncident.Requesterid);
        txtUsername.Text        = objUsr.Username;
        txtEmail.Text           = objInfo.Emailid;
        ViewState["UserCreate"] = "Exist";
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim();
        string statusString   = "";
        int    incidentid     = Convert.ToInt16(Request.QueryString[0]);

        Objincident          = Objincident.Get_By_id(incidentid);
        Objincidentstate     = Objincidentstate.Get_By_id(incidentid);
        Objincidentresoution = Objincidentresoution.Get_By_id(incidentid);
        objstatus            = objstatus.Get_By_id(Objincidentstate.Statusid);
        statusString         = objstatus.Statusname.ToString();
        if (statusString.ToLower() == strStatusClose.ToLower())
        {
            lbltcktno.Text     = Objincident.Incidentid.ToString();
            lblcreatedate.Text = Objincident.Createdatetime.ToString();

            if (Objincidentstate.AssignedTime != null)
            {
                lblstarttime.Text = Objincidentstate.AssignedTime.ToString();
            }
            lblendtime.Text = Objincident.Completedtime.ToString();
            Objcategory     = Objcategory.Get_By_id(Objincidentstate.Categoryid);

            lblcomponenteffected.Text = Objcategory.CategoryName.ToString();
            lbldescription.Text       = Objincident.Title.ToString();
            string bb       = Objincidentresoution.Resolution.ToString();
            string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty);
            lblresolution.Text = stripped.ToString();
            //bind data to data bound controls and do other stuff
            objUser           = objUser.Get_By_id(Objincident.Requesterid);
            lblcustomer.Text  = objUser.Username.ToString();
            objUser           = objUser.Get_By_id(Objincidentstate.Technicianid);
            lblengineer.Text  = objUser.Username.ToString();
            objstatus         = objstatus.Get_By_id(Objincidentstate.Statusid);
            lblrcaresult.Text = objstatus.Statusname.ToString();
        }
        Response.Clear();       //this clears the Response of any headers or previous output
        Response.Buffer = true; //make sure that the entire output is rendered simultaneously

        ///
        ///Set content type to MS Excel sheet
        ///Use "application/msword" for MS Word doc files
        ///"application/pdf" for PDF files
        ///

        Response.ContentType = "application/vnd.ms-excel";
        StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used

        HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);

        ///
        ///Render the entire Page control in the HtmlTextWriter object
        ///We can render individual controls also, like a DataGrid to be
        ///exported in custom format (excel, word etc)
        ///
        this.RenderControl(htmlTextWriter);
        Response.Write(stringWriter.ToString());
        Response.End();
    }
Exemplo n.º 3
0
    protected void BindIncidentToProblem()
    {
        if (Session["IncidentToProblem"] != null)
        {
            int incidentid = Convert.ToInt32(Session["IncidentToProblem"].ToString());

            Incident_mst   objIncident       = new Incident_mst();
            IncidentStates objIncidentStates = new IncidentStates();
            objIncident       = objIncident.Get_By_id(incidentid);
            objIncidentStates = objIncidentStates.Get_By_id(incidentid);
            objuser           = objuser.Get_By_id(objIncident.Requesterid);
            if (objIncidentStates.Priorityid != 0)
            {
                drpPriority.SelectedValue = Convert.ToString(objIncidentStates.Priorityid);
            }
            if (objIncidentStates.Categoryid != 0)
            {
                drpCategory.SelectedValue = Convert.ToString(objIncidentStates.Categoryid);
                BindDropSubCategory();
            }


            if (objIncidentStates.Subcategoryid != 0)
            {
                drpSubcategory.SelectedValue = Convert.ToString(objIncidentStates.Subcategoryid);
            }
            if (objIncidentStates.Technicianid != 0)
            {
                drpTechnician.SelectedValue = Convert.ToString(objIncidentStates.Technicianid);
            }
            txtDescription.Text = objIncident.Description;
            txtTitle.Text       = objIncident.Title;
            if (objuser.Userid != 0)
            {
                ContactInfo_mst objInfo = new ContactInfo_mst();
                objInfo                 = objInfo.Get_By_id(objuser.Userid);
                txtUsername.Text        = objuser.Username;
                txtEmail.Text           = objInfo.Emailid;
                ViewState["UserCreate"] = "Exist";
            }
        }
    }
    protected void BindIncidentToProblem()
    {
        if (Session["IncidentToProblem"] != null)
        {
            int incidentid = Convert.ToInt16(Session["IncidentToProblem"].ToString());

            Incident_mst objIncident = new Incident_mst();
            IncidentStates objIncidentStates = new IncidentStates();
            objIncident = objIncident.Get_By_id(incidentid);
            objIncidentStates = objIncidentStates.Get_By_id(incidentid);
            objuser = objuser.Get_By_id(objIncident.Requesterid);
            if (objIncidentStates.Priorityid != 0)
            {
                drpPriority.SelectedValue = Convert.ToString(objIncidentStates.Priorityid);

            }
            if (objIncidentStates.Categoryid != 0)
            {
                drpCategory.SelectedValue = Convert.ToString(objIncidentStates.Categoryid);
                BindDropSubCategory();

            }

            if (objIncidentStates.Subcategoryid  != 0)
            {

                drpSubcategory.SelectedValue = Convert.ToString(objIncidentStates.Subcategoryid);
            }
            if (objIncidentStates.Technicianid  != 0)
            {
                drpTechnician.SelectedValue = Convert.ToString(objIncidentStates.Technicianid);

            }
            txtDescription.Text = objIncident.Description;
            txtTitle.Text  = objIncident.Title;
            if (objuser.Userid != 0)
            {
                ContactInfo_mst objInfo = new ContactInfo_mst();
                objInfo = objInfo.Get_By_id(objuser.Userid);
                txtUsername.Text = objuser.Username;
                txtEmail.Text = objInfo.Emailid;
                ViewState["UserCreate"] = "Exist";
            }

        }
    }
    //#region Handle Button btnAssigned Click Event
    //protected void btnAssigned_Click(object sender, EventArgs e)
    //{
    //    #region Fetch Each Row from GridView,and Check Which Check Box is Selected
    //    foreach (GridViewRow gv in grdvwRequest.Rows)
    //    {
    //        string gvIDs;
    //        #region Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
    //         CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
    //        #endregion
    //        #region If deleteChkBxItem is Checked then ,mapped Current site to this user
    //         if (deleteChkBxItem.Checked)
    //        {
    //            #region Declare local Variables
    //            int incidentid;
    //            int varSiteid;
    //            int oldtechnicianvalue;
    //            #endregion
    //            #region Get the Incident Id from variable of Label type declare in GridView of grdvwSite
    //              gvIDs = ((Label)gv.FindControl("incidentid")).Text.ToString();
    //            #endregion
    //            #region Convert to incident id into integer
    //              incidentid = Convert.ToInt32(gvIDs);
    //              #endregion
    //            #region If Incident id in Not Null
    //            if (gvIDs != "")
    //            {
    //                Incident_mst objInc = new Incident_mst();
    //                IncidentStates objIncSta = new IncidentStates();
    //                objIncSta = objIncSta.Get_By_id(incidentid);
    //                if (objIncSta.Incidentid != 0)
    //                {
    //                    oldtechnicianvalue = objIncSta.Technicianid;
    //                    int technicianid=Convert.ToInt32(drpTechnician1.SelectedValue);
    //                    if(technicianid!=0)
    //                    {
    //                     int userid = Convert.ToInt32(ViewState["Userid"].ToString());
    //                    #region Update into IncidentStates Table
    //                     objIncidentStates.Incidentid = incidentid;
    //                    objIncidentStates.Technicianid = technicianid;
    //                    objIncidentStates.Subcategoryid = objIncSta.Subcategoryid;
    //                    objIncidentStates.Statusid = objIncSta.Statusid;
    //                    objIncidentStates.Requesttypeid = objIncSta.Requesttypeid;
    //                    objIncidentStates.Priorityid = objIncSta.Priorityid;
    //                    objIncidentStates.Categoryid = objIncSta.Categoryid;
    //                    objIncidentStates.AssignedTime = objIncSta.AssignedTime;
    //                    objIncidentStates.Update();
    //                     #endregion
    //                    #region Insert into IncidentHistory Table
    //                    objIncidentHistory.Incidentid = incidentid;
    //                    objIncidentHistory.Operationownerid = userid;
    //                    objIncidentHistory.Operation = "update";
    //                    objIncidentHistory.Insert();
    //                    #endregion
    //                    #region Get the Current historyid by calling function Get_Current_IncidentHistoryid()
    //                    int  historyid = objIncidentHistory.Get_Current_IncidentHistoryid();
    //                    #endregion
    //                   #region If technician value is changed,Insert into IncidentHistoryDiff table
    //                    #region Declare Local variables
    //                        string columnName;
    //                        string prev_value;
    //                        string curnt_value;
    //                    #endregion
    //                    #region Get Column Name from MessageResource File
    //                        columnName = Resources.MessageResource.strColumnTechnicianid.ToString();
    //                        #endregion
    //                       prev_value = Convert.ToString(oldtechnicianvalue);
    //                       curnt_value = Convert.ToString(drpTechnician1.SelectedValue);
    //                       objIncidentHistoryDiff.Historyid = historyid;
    //                       objIncidentHistoryDiff.Columnname = columnName;
    //                       objIncidentHistoryDiff.Current_value = curnt_value;
    //                       objIncidentHistoryDiff.Prev_value = prev_value;
    //                       objIncidentHistoryDiff.Insert();
    //                       if (objIncSta.AssignedTime == null)
    //                       {
    //                           columnName = Resources.MessageResource.strColumnAssignedTime.ToString();
    //                           prev_value = "0";
    //                           curnt_value = DateTime.Now.ToString();
    //                           objIncidentHistoryDiff.Historyid = historyid;
    //                           objIncidentHistoryDiff.Columnname = columnName;
    //                           objIncidentHistoryDiff.Current_value = curnt_value;
    //                           objIncidentHistoryDiff.Prev_value = prev_value;
    //                           objIncidentHistoryDiff.Insert();
    //                       }
    //                       else
    //                       {
    //                           columnName = "AssignedTime";
    //                           prev_value = objIncSta.AssignedTime;
    //                           curnt_value = DateTime.Now.ToString();
    //                           objIncidentHistoryDiff.Historyid = historyid;
    //                           objIncidentHistoryDiff.Columnname = columnName;
    //                           objIncidentHistoryDiff.Current_value = curnt_value;
    //                           objIncidentHistoryDiff.Prev_value = prev_value;
    //                           objIncidentHistoryDiff.Insert();
    //                       }
    //                   #endregion
    //                       objInc = objIncident.Get_By_id(incidentid);
    //                       if (objInc.Siteid != Convert.ToInt32(drpSite1.SelectedValue))
    //                       {
    //                           int oldsiteid = objInc.Siteid;
    //                           int oldslaid = objInc.Slaid;
    //                           objInc.Siteid = Convert.ToInt32(drpSite1.SelectedValue);
    //                           int SLAid = objIncident.Get_By_SLAid(Convert.ToInt32(drpSite1.SelectedValue), objIncSta.Priorityid );
    //                           int requesttypeid = Convert.ToInt32(Resources.MessageResource.strRequestTypeId.ToString());
    //                           if (requesttypeid == Convert.ToInt32(objIncSta.Requesttypeid ))
    //                           {
    //                               SLAid = 0;
    //                           }
    //                           objInc.Slaid = SLAid;
    //                           objInc.Active = true;
    //                           objInc.Update();
    //                           #region If site value is changed,Insert into IncidentHistoryDiff table
    //                           columnName = Resources.MessageResource.strColumnSiteid.ToString();
    //                           prev_value = Convert.ToString(oldsiteid);
    //                           curnt_value = drpSite1.SelectedValue;
    //                           objIncidentHistoryDiff.Historyid = historyid;
    //                           objIncidentHistoryDiff.Columnname = columnName;
    //                           objIncidentHistoryDiff.Current_value = curnt_value;
    //                           objIncidentHistoryDiff.Prev_value = prev_value;
    //                           objIncidentHistoryDiff.Insert();
    //                           #endregion
    //                           #region If SLA value is changed,Insert into IncidentHistoryDiff table
    //                           columnName = Resources.MessageResource.strColumnSLAid.ToString();
    //                           prev_value = Convert.ToString(oldslaid);
    //                           curnt_value = Convert.ToString(SLAid);
    //                           objIncidentHistoryDiff.Historyid = historyid;
    //                           objIncidentHistoryDiff.Columnname = columnName;
    //                           objIncidentHistoryDiff.Current_value = curnt_value;
    //                           objIncidentHistoryDiff.Prev_value = prev_value;
    //                           objIncidentHistoryDiff.Insert();
    //                           #endregion
    //                       }
    //                    }
    //                }
    //                varSiteid = Convert.ToInt32(drpSite.SelectedValue);
    //                if (varSiteid == 0)
    //                { BindGridForAllParameter(); }
    //                else { BindGridForSelectedParameter(); }
    //            }
    //            #endregion
    //        }
    //         #endregion
    //    }
    //    #endregion
    //}
    //#endregion
    protected void BindSelectedFilter()
    {
        string keyword = Session["keyword"].ToString();
        string Filterid = Session["Filterid"].ToString();
        #region Declaration of localvariable and table Variable
        DataTable dtTable = new DataTable();
        dtTable = CreateDataTable();

        #endregion
        BLLCollection<Incident_mst> col = new BLLCollection<Incident_mst>();
        col = objIncident.Get_All_Incidentid_By_SearchParameter(Filterid, keyword);
        #region Create Table row and assign value to it
        foreach (Incident_mst obj in col)
        {
            IncidentStates objS = new IncidentStates();
            DataRow row;
            row = dtTable.NewRow();
            row["incidentid"] = Convert.ToString(obj.Incidentid);
            row["title"] = obj.Title;
            row["requesterid"] = Convert.ToString(obj.Requesterid);
            row["createdbyid"] = Convert.ToString(obj.Createdbyid);
            row["siteid"] = Convert.ToString(obj.Siteid);
            row["createdatetime"] = Convert.ToString(obj.Createdatetime);
            objS = objS.Get_By_id(obj.Incidentid);
            row["statusid"] = objS.Statusid;
            row["technicianid"] = objS.Technicianid;
            row["priorityid"] = objS.Priorityid;
            dtTable.Rows.Add(row);
        }
        #endregion

        grdvwRequest.DataSource = dtTable;
        grdvwRequest.DataBind();
        Session.Remove("Filterid");
        Session.Remove("keyword");
        ViewState["keyword"] = keyword;
        ViewState["Filterid"] = Filterid;
    }
Exemplo n.º 6
0
    protected void Bindgrid()
    {
        #region Declaration of localvariable and table Variable
        int       filterId;
        DataTable dtTable = new DataTable();
        dtTable = CreateDataTable();
        string userName         = "";
        int    varTechnicianId  = 0;
        string varSortParameter = "createdatetime";

        #endregion

        #region Get Current User and his Role
        MembershipUser User              = Membership.GetUser();
        string         varUserRole       = "";
        string         varRoleTechnician = "";
        if (User != null)
        {
            userName = User.UserName.ToString();
            string[] arrUserRole = Roles.GetRolesForUser();
            varUserRole       = arrUserRole[0].ToString();
            varRoleTechnician = Resources.MessageResource.strTechnicianRole.ToString();
        }
        #endregion

        #region Get User object  by Calling Function Get_UserLogin_By_UserName() via passing parameter username and organizationid
        objOrganization = objOrganization.Get_Organization();
        objUser         = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid);
        #endregion


        #region If User Exist
        if (objUser.Userid != 0)
        {
            string fromdate = null;
            string todate   = null;

            #region Find how many sites have been mapped to current user by calling function Get_All_By_userid() via passing parameter userid
            int userid = objUser.Userid;
            colUserToSite = ObjUserToSite.Get_All_By_userid(userid);
            #endregion
            #region Fetch each object from Collection of UserToSiteMapping
            foreach (UserToSiteMapping obj in colUserToSite)
            {
                #region Declare Local Variables and Collection of Incident_mst Type
                string Status;
                BLLCollection <Incident_mst> col = new BLLCollection <Incident_mst>();
                int siteid;
                #endregion
                #region Get the Siteid and Filter Parameter
                siteid   = obj.Siteid;
                filterId = 0;
                #endregion

                #region If Role of User is Technician



                #region If Filter Variable is All
                if (filterId == 0)
                {
                    col = objIncident.Get_All_By_Siteid_Requesterid(siteid, objUser.Userid, fromdate, todate, varSortParameter);
                }
                #endregion



                #endregion



                #region Fetch Each object of type Incident_mst from Collection Incident_mst
                foreach (Incident_mst objInc in col)
                {
                    #region Create Table row and assign value to it
                    DataRow row;
                    row = dtTable.NewRow();
                    row["incidentid"]     = Convert.ToString(objInc.Incidentid);
                    row["title"]          = objInc.Title;
                    row["requesterid"]    = Convert.ToString(objInc.Requesterid);
                    row["createdbyid"]    = Convert.ToString(objInc.Createdbyid);
                    row["siteid"]         = Convert.ToString(objInc.Siteid);
                    row["createdatetime"] = Convert.ToString(objInc.Createdatetime);
                    objIncidentStates     = objIncidentStates.Get_By_id(objInc.Incidentid);
                    row["statusid"]       = objIncidentStates.Statusid;
                    row["technicianid"]   = objIncidentStates.Technicianid;
                    row["priorityid"]     = objIncidentStates.Priorityid;
                    dtTable.Rows.Add(row);
                    #endregion
                }
                #endregion
            }
            #endregion
            #region Bind Grid from datasource dtTable
            DataView dvData        = new DataView(dtTable);
            string   sortFormat    = "{0} {1}";
            String   sortDirection = "DESC";
            if (varSortParameter == "createdatetime")
            {
                varSortParameter = "incidentid";
            }
            dvData.Sort = String.Format(sortFormat, varSortParameter, sortDirection);



            grdvwRequest.DataSource = dvData;
            grdvwRequest.DataBind();
            #endregion
        }
        #endregion
    }
Exemplo n.º 7
0
    public void SentmailUser(int userid, int incidentid, string status)
    {
        objIncident = objIncident.Get_By_id(incidentid);
        //added by lalit 02 nov to get resolution and show it to user when call closed mail goes to user
        objIncidentResolution = objIncidentResolution.Get_By_id(incidentid);
        //end
        objSite           = objSite.Get_By_id(objIncident.Siteid);
        objAreaManager    = objAreaManager.Get_By_id(objSite.Siteid);
        objIncidentStates = objIncidentStates.Get_By_id(incidentid);
        objPriority       = objPriority.Get_By_id(objIncidentStates.Priorityid);
        objUser           = objUser.Get_By_id(objIncident.Requesterid);
        objC_info         = objC_info.Get_By_id(userid);
        objtech           = objtech.Get_By_id(objIncidentStates.Technicianid);
        colemailid        = objemail.Get_All_userid(userid);
        string strStatusOpen     = Resources.MessageResource.strStatusOpen.ToString();
        string strStatusClose    = Resources.MessageResource.strStatusClose.ToString();
        string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString();
        string strContactNumber  = Resources.MessageResource.strContactNumber.ToString();

        if (strStatusOpen.ToLower() == status.ToLower())
        {
            foreach (UserEmail obj1 in colemailid)
            {
                if (obj1.Emailid != null)
                {
                    obj.From    = Resources.MessageResource.strAdminEmail.ToString();
                    obj.To      = obj1.Emailid;
                    obj.CC      = objAreaManager.Email;
                    obj.Subject = "Call Logged. Ticket Id : " + incidentid;
                    obj.Body    = "Dear " + objC_info.Firstname + ",<br/><br/> Thank you for contacting IT Service desk, please find below the new Ticket Id details for your future reference.<br/><br/><b>Incident Details : </b> <br/><br/><b>Ticket Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + incidentid + "<br/><b>Site&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + objSite.Sitename + "<br/><b>Logged Date & Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + objIncident.Createdatetime + "<br/><b>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + objIncident.Description + "<br/><b>Priority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + objPriority.Name + "<br/><b>Username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + objUser.Username + "<br/><b>EstimatedResolutionTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                  + GetResolutionTimeInHours(objIncident.Slaid)
                                  + "<br/><b>Email Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "

                                  + objC_info.Emailid + "<br/><br/> For any other support, kindly get in touch with us at " + strContactNumber + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> " + strYourSinscerely + "</b>";
                    obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
                    obj.SentMail();
                    string varPriority = Resources.MessageResource.strPriorityHigh.ToString();
                    if (objPriority.Priorityid != 0)
                    {
                        if (objPriority.Name.ToLower() == varPriority.ToLower())
                        {
                            SentMailToSDM(objSite.Siteid, incidentid, objUser.Userid);
                        }
                    }
                }
            }
            //if (objC_info.Emailid != null)
            //{
            //    obj.From = Resources.MessageResource.strAdminEmail.ToString();
            //    obj.To = objC_info.Emailid;
            //    obj.Subject = " New Call Logged. Ticket Id : " + incidentid;
            //    obj.Body = "Dear User,<br/> Thank you for contacting Service desk, please find below the Ticket Id details for your future reference.<br/><br/><b>Complaints Details : </b> <br/><br/><b>Ticket Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + incidentid + "<br/><b>Title of Call&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objIncident.Title + " <br/><b>Site&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSite.Sitename + "<br/><b>Logged Date & Time&nbsp;&nbsp&nbsp;&nbsp;&nbsp;:</b>" + objIncident.Createdatetime + "<br/><b>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objIncident.Description + "<br/><b>Priority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> " + objPriority.Name + "<br/><b>UserName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objUser.Username + "<br/><b>Mail Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objC_info.Emailid + "<br/><br/> For any other support kindly get in touch with us at <b>" + strContactNumber + "</b>.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/> <b>" + strYourSinscerely + "</b>";
            //    obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
            //   //obj.SentMail();
            //    string varPriority = Resources.MessageResource.strPriorityHigh.ToString();
            //    if (objPriority.Priorityid != 0)
            //    {
            //        if (objPriority.Name.ToLower() == varPriority.ToLower())
            //        {
            //            SentMailToSDM(objSite.Siteid, incidentid, objUser.Userid);
            //        }
            //    }
            //}
        }
        if (strStatusClose.ToLower() == status.ToLower())
        {
            foreach (UserEmail obj1 in colemailid)
            {
                if (obj1.Emailid != null)
                {
                    int    id = Convert.ToInt16(objIncident.Incidentid);
                    string varServerName1;
                    string varfeedbackmode;
                    varServerName1 = Resources.MessageResource.serverNameForChangePage.ToString();
                    //added by lalit to check feedback mode. feedback should add in mail or not.
                    //fetching value from resouce file which is from appsettting page.
                    varfeedbackmode = Resources.MessageResource.UserFeedbackmode.ToString();
                    string url11;
                    url11 = "http://" + varServerName1 + "/" + getpath() + "/LoginPageAccess/CustomerFeedback.aspx?userid=" + userid + "&Clid=" + objIncident.Incidentid;
                    //url11 = "../LoginPageAccess/CustomerFeedback.aspx?userid=" + userid + "&Clid=" + objIncident.Incidentid;
                    if (objC_info.Emailid != null)
                    {
                        // string url;
                        //    url = "<a  href=" + url11 + "&userid=" + objC_info.Firstname + " ' onclick=window.open()>Your Feedback</a>";
                        string url = "<a  href=" + url11 + " ' onclick=window.open()>Your Feedback</a>";
                        obj.From    = Resources.MessageResource.strAdminEmail.ToString();
                        obj.To      = obj1.Emailid;
                        obj.CC      = objAreaManager.Email;
                        obj.Subject = "Call Closed Ticket id : " + incidentid;
                        //added by lalit
                        if (varfeedbackmode == "0") //0 means default mode where user will not recieve link in mail to give feedback
                        {
                            obj.Body = "Dear " + objC_info.Firstname
                                       + ",<br/><br/> <b>Incident Status:</b> Issue Resolved and call closed by&nbsp;<b>"
                                       + objtech.Username + "</b>&nbsp;on&nbsp;<b>"
                                       + objIncident.Completedtime + ".<br/><br/></b>We are pleased to confirm that the Service Call reported by you has been attended and resolved, should there be any further questions or queries, please do not hesitate to contact the Service Desk." + "<br/><br/><b>Incident Details : </b> <br/><br/><b>Ticket Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + incidentid + "<br/><b>Site&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objSite.Sitename + "<br/><b>Logged Date & Time&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;:</b> "
                                       + objIncident.Createdatetime + "<br/><b>Closed Date & Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objIncident.Completedtime + "<br/><b>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objIncident.Description + "<br/><b>Resolution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objIncidentResolution.Resolution + "<br/><b>Priority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objPriority.Name + "<br/><b>Username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objUser.Username + "<br/><b>Email Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objC_info.Emailid + "<br/><br/> For any other support, kindly get in touch with us at "
                                       + strContactNumber + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b>"
                                       + strYourSinscerely + "</b>";
                        }
                        else
                        {
                            obj.Body = "Dear " + objC_info.Firstname
                                       + ",<br/><br/> <b>Incident Status:</b> Issue Resolved and call closed by&nbsp;<b>"
                                       + objtech.Username + "</b>&nbsp;on&nbsp;<b>"
                                       + objIncident.Completedtime + ".<br/><br/></b>We are pleased to confirm that the Service Call reported by you has been attended and resolved, should there be any further questions or queries, please do not hesitate to contact the Service Desk." + "<br/><br/><b>Incident Details : </b> <br/><br/><b>Ticket Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + incidentid + "<br/><b>Site&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objSite.Sitename + "<br/><b>Logged Date & Time&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;:</b> "
                                       + objIncident.Createdatetime + "<br/><b>Closed Date & Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objIncident.Completedtime + "<br/><b>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objIncident.Description + "<br/><b>Resolution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objIncidentResolution.Resolution + "<br/><b>Priority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objPriority.Name + "<br/><b>Username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objUser.Username + "<br/><b>Email Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> "
                                       + objC_info.Emailid + "<br/><br/> For any other support, kindly get in touch with us at "
                                       + strContactNumber + ".<br/><br/>To give feedback click on "
                                       + url + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b>"
                                       + strYourSinscerely + "</b>";
                        }
                        obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
                        obj.SentMail();
                    }
                }
            }
            //int id = Convert.ToInt16(objIncident.Incidentid);
            //string varServerName1;
            //varServerName1 = Resources.MessageResource.serverNameForChangePage.ToString();
            //// varServerName = "10.80.0.15";
            //string url11;
            //url11 = "http://" + varServerName1 + "/BESTN/LoginPageAccess/CustomerFeedback.aspx?incident=" + id;
            //if (objC_info.Emailid != null)
            //{
            //    string url;
            //    url = "<a  href=" + url11 + "&userid=" + objC_info.Firstname + " ' onclick=window.open()>Your Feedback</a>";
            //    obj.From = Resources.MessageResource.strAdminEmail.ToString();
            //    obj.To = objC_info.Emailid;
            //    obj.Subject = "Call Closed Ticket id : " + incidentid;
            //    obj.Body = "Dear User,<br/> <b>Complaint Status:</b>Problem solved and call closed by&nbsp;<b>" + objtech.Username + "</b>&nbsp;on&nbsp;<b>" + objIncident.Completedtime + "</b>.We are pleased to inform you that your reported Service Call has been attended and problem solved as informed by our engineer.<br/>Should there be any further questions or queries, please do not hesitate to contact the Service Desk on 0120 4393941, quoting your Ticket Reference Number.   " + "<br/><br/><b>Complaints Details : </b> <br/><br/><b>Ticket Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + incidentid + "<br/><b>Title of Call&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objIncident.Title + " <br/><b>Site&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSite.Sitename + "</br><b>Logged Date & Time&nbsp;&nbsp&nbsp;&nbsp;&nbsp;:</b>" + objIncident.Createdatetime + "<br/><b>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objIncident.Description + "<br/><b>Priority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> " + objPriority.Name + "<br/><b>UserName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objUser.Username + "<br/><b>Mail Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objC_info.Emailid + "<br/><br/> For any other support kindly get in touch with us at <b>" + strContactNumber + "</b>.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Your Feedback</b><br/><br/>" + url + "<br/><br/><b>Yours sincerely,</b><br/> <b>" + strYourSinscerely + "</b>";
            //    obj.SmtpServer = obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
            //   // obj.SentMail();
            //}
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            # region Declare Local Variable
            string StrStatusRequested;
            string StrStatusRejected;
            string StrStatusApproval;
            string StrStatusApproved;
            string StrStatusPlanning;
            string StrStatusTesting;
            string StrStatusRelease;
            string StrStatusImplemented;
            string StrStatusCompleted;
            string StrStatusString = "";
            int userid = 0;
            int changeid = Convert.ToInt32(Request.QueryString[0]);
            string userName = "";
            #endregion
            #region Fetch the Status Value from Resource File
            StrStatusString = GetChangeStatusString(Convert.ToInt32(drpStatus.SelectedValue));
            StrStatusRejected = Resources.MessageResource.StrRejected.ToString();
            StrStatusApproval = Resources.MessageResource.StrApproval.ToString();
            StrStatusRequested = Resources.MessageResource.StrRequested.ToString();
            StrStatusApproved = Resources.MessageResource.StrApproved.ToString();
            StrStatusPlanning = Resources.MessageResource.StrPlanning.ToString();
            StrStatusTesting = Resources.MessageResource.StrTesting.ToString();
            StrStatusRelease = Resources.MessageResource.StrRelease.ToString();
            StrStatusImplemented = Resources.MessageResource.StrImplemented.ToString();
            StrStatusCompleted = Resources.MessageResource.StrCompleted.ToString();

            #endregion
            MembershipUser User = Membership.GetUser();
            userName = User.UserName.ToString();

            #region On the basis of Username ,get Userid by calling Function Get_UserLogin_By_UserName(),via passing parameter Username and organizationid

            if (userName != "")
            {
                Objorganization = Objorganization.Get_Organization();
                ObjUser = ObjUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid);
                if (ObjUser.Userid != 0)
                {
                    userid = ObjUser.Userid;
                }
            }
            #endregion

            #region Insert Historyvalue in Change History Table
            int result = String.Compare(StrStatusString, StrStatusRequested, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Requested";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusRejected, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Rejected";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusApproval, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Approval";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusApproved, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Approved";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusPlanning, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Planning";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusTesting, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Testing";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusRelease, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Release";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusImplemented, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Implemented";
                ObjChangeHistory.Insert();
            }
            result = String.Compare(StrStatusString, StrStatusCompleted, true);
            if (result == 0)
            {
                ObjChangeHistory.Changeid = changeid;
                ObjChangeHistory.Operationownerid = userid;
                ObjChangeHistory.Operation = "Completed";
                ObjChangeHistory.Insert();
            }
            #endregion
            #region Get the Current historyid by calling function Get_Current_ProblemHistoryid()

            int historyid = ObjChangeHistory.Get_Current_ChangeHistoryid();
            #endregion
            #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid

            ObjChange = ObjChange.Get_By_id(changeid);

            #endregion
            #region Insert into ChangeHistoryDiff table ,By Comparing Current value and Updated Values
            if (ObjChange.Changeid != 0)
            {
                #region Declare local variable
                string columnName;
                string prev_value;
                string curnt_value;
                #endregion
                #region If Priority value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Priority != Convert.ToInt32(drpPriority.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnPriorityid.ToString();
                    prev_value = Convert.ToString(ObjChange.Priority);
                    curnt_value = Convert.ToString(drpPriority.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Technician value is changed,Insert into ChangeHistoryDiff table
                if (ObjChange.Technician != Convert.ToInt32(drpTechnician.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnTechnicianid.ToString();
                    prev_value = Convert.ToString(ObjChange.Technician);
                    curnt_value = Convert.ToString(drpTechnician.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();

                }
                #endregion
                #region If category value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Categoryid != Convert.ToInt32(drpCategory.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnCategoryid.ToString();
                    prev_value = Convert.ToString(ObjChange.Categoryid);
                    curnt_value = Convert.ToString(drpCategory.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Subcategory value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Subcategoryid != Convert.ToInt32(drpSubcategory.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnSubcategoryid.ToString();
                    prev_value = Convert.ToString(ObjChange.Subcategoryid);
                    curnt_value = Convert.ToString(drpSubcategory.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Changetype value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Changetype != Convert.ToInt32(drpchangetype.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnChangeType.ToString();
                    prev_value = Convert.ToString(ObjChange.Changetype);
                    curnt_value = Convert.ToString(drpchangetype.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion
                #region If Changestatus value is changed,Insert into ChangeHistoryDiff table

                if (ObjChange.Changetype != Convert.ToInt32(drpStatus.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnstatusid.ToString();
                    prev_value = Convert.ToString(ObjChange.Statusid);
                    curnt_value = Convert.ToString(drpStatus.SelectedValue);
                    ObjChangeHistoryDiff.Historyid = historyid;
                    ObjChangeHistoryDiff.Columnname = columnName;
                    ObjChangeHistoryDiff.Current_value = curnt_value;
                    ObjChangeHistoryDiff.Prev_value = prev_value;
                    ObjChangeHistoryDiff.Insert();
                }
                #endregion

            }
            #endregion
            #region Update the completed status

            #endregion
            #region update the data in change_mst table

            ObjChange.Technician = Convert.ToInt32(drpTechnician.SelectedValue);
            ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue);
            ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue);
            ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue);
            ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue);
            ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue);
            ObjChange.Changeid = Convert.ToInt32(Request.QueryString[0]);
            ObjChange.Active = true;
            #region If Current status is closed,then Assign Completed time
            result = String.Compare(StrStatusString, StrStatusCompleted, true);
            if (result == 0)
            {
                BLLCollection<Incident_To_Change> colincidentchnage = new BLLCollection<Incident_To_Change>();
                colincidentchnage = Objincidenttochange.Get_All_By_Changeid(changeid);
                int id = 0;
                foreach (Incident_To_Change objitoc in colincidentchnage)
                {
                    id = Convert.ToInt32(objitoc.Incidentid);
                }

                IncidentStates objstate = new IncidentStates();
                objstate = objstate.Get_By_id(id);
                Status_mst objincidentstats = new Status_mst();

                objincidentstats = objincidentstats.Get_By_id(objstate.Statusid);
                string currentincidentstatus = objincidentstats.Statusname.ToString();
                int comparestatus = String.Compare(currentincidentstatus, Resources.MessageResource.strStatusClose.ToString(), true);
                if (comparestatus == 0)
                {
                    ObjChange.Completedtime = DateTime.Now.ToString();
                    Change_mst Objcurrentchange = new Change_mst();
                    ChangeStatus_mst Objchangestatus = new ChangeStatus_mst();
                    Objcurrentchange = Objcurrentchange.Get_By_id(changeid);
                    Objchangestatus = Objchangestatus.Get_By_id(Objcurrentchange.Statusid);
                    string status = Objchangestatus.Statusname.ToString();

                    int result1 = String.Compare(status, StrStatusCompleted, true);
                    if (result1 == 0)
                    {
                        ObjChange.Completedtime = Objcurrentchange.Completedtime;
                        ObjChange.Update();

                    }
                    else
                    {
                        ObjChange.Completedtime = DateTime.Now.ToString();
                        ObjChange.Update();

                    }
                }

                else
                {
                    string myScript;
                    //myScript = "<script language=javascript>javascript:alert('Please Close All the Attached Incident');</script>";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Javascript:alert('Please Close Alll the attached incident');", "Javascript:alert('Please Close Alll the attached incident');", true);
                    ///'''Page.RegisterClientScriptBlock("MyScript", myScript);
                }

            }
            else
            {

            #endregion

                ObjChange.Update();

            }

            #endregion
            //   #region Update Include Assets in Change value in IncludedAssetinchange

            //objincludeasset.Delete(changeid);
            //for (int i = lstassetupdate.Items.Count - 1; i >= 0; i--)
            //{
            //    if (lstassetupdate.Items[i].Selected == true)
            //    {
            //        objincludeasset.Assetid = Convert.ToInt32(lstassetupdate.Items[i].Value);
            //        objincludeasset.Changeid = changeid;
            //        objincludeasset.Insert();

            //    }
            //}

            //#endregion
            Showchangeinfo();
            btnUpdate.Visible = false;
            btnCancel.Visible = false;
        }
    protected void FunctionUpdate()
    {
        #region Get incidentid from QueryString
        int incidentid = Convert.ToInt32(Request.QueryString[0]);
        #endregion

        #region Declare Local Variable
        // Declare local Variable
        int historyid;
        int varTotalTimeSpentonCall = 0;
        int SLAid;
        string userName;
        int userid = 0;
        string strCreateDatetime = "";
        string statusString;
        string strStatusOpen;
        string strStatusClose;
        string strStatusResolved;
        string strStatusOnHold;
        bool FlagTechnicianId;
        bool FlagCloseStatus;
        int requesttypeid;
        string OldStatusString;
        FlagTechnicianId = false;
        FlagCloseStatus = false;
        string oldCompletedTime = "";
        Incident_mst objIncidentOld = new Incident_mst();
        IncidentStates objIncidentStatesOld = new IncidentStates();

        bool FlagClosedStatus = true;
        string VarResolutionAdded = "";
        #endregion

        #region Fetch Current User
        // Fetch Current User and assign to local variable userName
        MembershipUser User = Membership.GetUser();
        userName = User.UserName.ToString();
        #endregion

        #region Fetch Data from MessageResource file and assign to Local Variable

        statusString = GetStatusString(Convert.ToInt32(drpStatus.SelectedValue));
        strStatusOpen = Resources.MessageResource.strStatusOpen.ToString().Trim();
        strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim();
        strStatusResolved = Resources.MessageResource.strStatusResolved.ToString().Trim();
        strStatusOnHold = Resources.MessageResource.strStatusOnHold.ToString().Trim();

        #endregion

        # region Get SLAid by Calling Function Get_By_SLAid() ,via Passing Parameter siteid and priorityid

        SLAid = objIncident.Get_By_SLAid(Convert.ToInt32(drpSite.SelectedValue), Convert.ToInt32(drpPriority.SelectedValue));
        requesttypeid = Convert.ToInt32(Resources.MessageResource.strRequestTypeId.ToString());
        if (requesttypeid == Convert.ToInt32(drpRequestType.SelectedValue))
        {
            SLAid = 0;
        }
        #endregion

        #region On the basis of Username ,get Userid by calling Function Get_UserLogin_By_UserName(),via passing parameter Username and organizationid

        if (userName != "")
        {
            objOrganization = objOrganization.Get_Organization();
            objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid);
            if (objUser.Userid != 0)
            {
                userid = objUser.Userid;
            }
        }
        #endregion

        //#region Insert value in IncidentHistory Table ,for every update of Page

        //if (statusString.ToLower() == strStatusClose.ToLower())
        //{
        //    if (Session["ResolutionAdded"] != null)
        //    {
        //        VarResolutionAdded = Session["ResolutionAdded"].ToString();
        //    }

        //    if (VarResolutionAdded == "true")
        //    {
        //        objIncidentHistory.Incidentid = incidentid;
        //        objIncidentHistory.Operationownerid = userid;
        //        objIncidentHistory.Operation = "closed";
        //        objIncidentHistory.Insert();
        //        Session["ResolutionAdded"] = "false";
        //    }
        //    else { FlagClosedStatus = false; }
        //}
        //else if (statusString.ToLower() == strStatusResolved.ToLower())
        //{

        //    objIncidentHistory.Incidentid = incidentid;
        //    objIncidentHistory.Operationownerid = userid;
        //    objIncidentHistory.Operation = "resolved";
        //    objIncidentHistory.Insert();
        //}
        //else
        //{

        //    objIncidentHistory.Incidentid = incidentid;
        //    objIncidentHistory.Operationownerid = userid;
        //    objIncidentHistory.Operation = "update";
        //    objIncidentHistory.Insert();

        //}
        //#endregion
        #region Insert value in IncidentHistory Table ,for every update of Page
        if (statusString.ToLower() == strStatusClose.ToLower())
        {
            objIncidentHistory.Incidentid = incidentid;
            objIncidentHistory.Operationownerid = userid;
            objIncidentHistory.Operation = "closed";
            objIncidentHistory.Insert();
        }
        else if (statusString.ToLower() == strStatusResolved.ToLower())
        {
            if (Session["ResolutionAdded"] != null)
            {
                VarResolutionAdded = Session["ResolutionAdded"].ToString();
            }

            if (VarResolutionAdded == "true")
            {
                objIncidentHistory.Incidentid = incidentid;
                objIncidentHistory.Operationownerid = userid;
                objIncidentHistory.Operation = "resolved";
                objIncidentHistory.Insert();
                Session["ResolutionAdded"] = "false";
            }
            else { FlagClosedStatus = false; }
            //objIncidentHistory.Incidentid = incidentid;
            //objIncidentHistory.Operationownerid = userid;
            //objIncidentHistory.Operation = "resolved";
            //objIncidentHistory.Insert();
        }
        else
        {

            objIncidentHistory.Incidentid = incidentid;
            objIncidentHistory.Operationownerid = userid;
            objIncidentHistory.Operation = "update";
            objIncidentHistory.Insert();
        }
        #endregion

        #region Get the Current historyid by calling function Get_Current_IncidentHistoryid()
        historyid = objIncidentHistory.Get_Current_IncidentHistoryid();
        #endregion

        #region Find Current value of Incident and IncidentStates object ,By Calling Function Get_By_id(),via passing incidentid
        objIncidentOld = objIncidentOld.Get_By_id(incidentid);
        objIncidentStatesOld = objIncidentStatesOld.Get_By_id(incidentid);
        #endregion

        if (FlagClosedStatus == true)
        {
            #region Insert into IncidentHistoryDiff table ,By Comparing Current value and Updated Values

            if (objIncidentOld.Incidentid != 0 && objIncidentStatesOld.Incidentid != 0)
            {
                #region Declare local variable
                string columnName;
                string prev_value;
                string curnt_value;
                #endregion

                #region If site value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentOld.Siteid != Convert.ToInt32(drpSite.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnSiteid.ToString();
                    prev_value = Convert.ToString(objIncidentOld.Siteid);
                    curnt_value = drpSite.SelectedValue;
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion
                #region If Department value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentOld.Deptid != Convert.ToInt32(drpDepartment.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnDeptid.ToString();
                    prev_value = Convert.ToString(objIncidentOld.Deptid);
                    curnt_value = drpDepartment.SelectedValue;
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion
                #region If Mode value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentOld.Modeid != Convert.ToInt32(drpMode.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnModeid.ToString();
                    prev_value = Convert.ToString(objIncidentOld.Modeid);
                    curnt_value = drpMode.SelectedValue;
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion
                #region If SLA value is changed,Insert into IncidentHistoryDiff table

                if (objIncidentOld.Slaid != SLAid)
                {
                    columnName = Resources.MessageResource.strColumnSLAid.ToString();
                    prev_value = Convert.ToString(objIncidentOld.Slaid);
                    curnt_value = Convert.ToString(SLAid);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion
                #region If Requesttype value is changed,Insert into IncidentHistoryDiff table

                if (objIncidentStatesOld.Requesttypeid != Convert.ToInt32(drpRequestType.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnRequesttypeid.ToString();
                    prev_value = Convert.ToString(objIncidentStatesOld.Requesttypeid);
                    curnt_value = Convert.ToString(drpRequestType.SelectedValue);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion

                #region If Priority value is changed,Insert into IncidentHistoryDiff table

                if (objIncidentStatesOld.Priorityid != Convert.ToInt32(drpPriority.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnPriorityid.ToString();
                    prev_value = Convert.ToString(objIncidentStatesOld.Priorityid);
                    curnt_value = Convert.ToString(drpPriority.SelectedValue);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion
                #region If Category value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentStatesOld.Categoryid != Convert.ToInt32(drpCategory.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnCategoryid.ToString();
                    prev_value = Convert.ToString(objIncidentStatesOld.Categoryid);
                    curnt_value = Convert.ToString(drpCategory.SelectedValue);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion
                #region If SubCategory value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentStatesOld.Subcategoryid != Convert.ToInt32(drpSubcategory.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnSubcategoryid.ToString();
                    prev_value = Convert.ToString(objIncidentStatesOld.Subcategoryid);
                    curnt_value = Convert.ToString(drpSubcategory.SelectedValue);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion

                #region If Status value is changed,Insert into IncidentHistoryDiff table

                if (objIncidentStatesOld.Statusid != Convert.ToInt32(drpStatus.SelectedValue))
                {
                    string Statusprev;
                    string StatusCurrent;
                    columnName = Resources.MessageResource.strColumnstatusid.ToString();
                    prev_value = Convert.ToString(objIncidentStatesOld.Statusid);
                    curnt_value = Convert.ToString(drpStatus.SelectedValue);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                    Statusprev = GetStatusString(Convert.ToInt32(objIncidentStatesOld.Statusid));
                    StatusCurrent = GetStatusString(Convert.ToInt32(drpStatus.SelectedValue));
                    if (Statusprev.ToLower() == strStatusOpen.ToLower() && StatusCurrent.ToLower() == strStatusOnHold.ToLower())
                    {
                        columnName = Resources.MessageResource.strColumnStarttime.ToString();
                        prev_value = "0";
                        curnt_value = DateTime.Now.ToString();
                        objIncidentHistoryDiff.Historyid = historyid;
                        objIncidentHistoryDiff.Columnname = columnName;
                        objIncidentHistoryDiff.Current_value = curnt_value;
                        objIncidentHistoryDiff.Prev_value = prev_value;
                        objIncidentHistoryDiff.Insert();
                    }

                    if (Statusprev.ToLower() == strStatusOnHold.ToLower() && StatusCurrent.ToLower() != strStatusOnHold.ToLower())
                    {
                        columnName = Resources.MessageResource.srColumnEndtime.ToString();
                        prev_value = "0";
                        curnt_value = DateTime.Now.ToString();
                        objIncidentHistoryDiff.Historyid = historyid;
                        objIncidentHistoryDiff.Columnname = columnName;
                        objIncidentHistoryDiff.Current_value = curnt_value;
                        objIncidentHistoryDiff.Prev_value = prev_value;
                        objIncidentHistoryDiff.Insert();
                    }
                    //Added by lalit
                    //if current techncian is wintel and current status is closed then
                    string prev_valuetechid = Convert.ToString(objIncidentStatesOld.Technicianid);
                    if (StatusCurrent == "Closed")
                    {
                        // if (prev_valuetechid == "11740")
                        if (IsSLANeedsToBeStopped(prev_valuetechid) == 1)
                        {
                            columnName = Resources.MessageResource.srColumnEndtime.ToString();
                            prev_value = "0";
                            curnt_value = DateTime.Now.ToString();
                            objIncidentHistoryDiff.Historyid = historyid;
                            objIncidentHistoryDiff.Columnname = columnName;
                            objIncidentHistoryDiff.Current_value = curnt_value;
                            objIncidentHistoryDiff.Prev_value = prev_value;
                            objIncidentHistoryDiff.Insert();
                        }
                    }
                    //end
                    //end lalit
                }
                #endregion

                #region If technician value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentStatesOld.Technicianid != Convert.ToInt32(drpTechnician.SelectedValue))
                {
                    string columnNametechid = Resources.MessageResource.strColumnTechnicianid.ToString();
                    string prev_valuetechid = Convert.ToString(objIncidentStatesOld.Technicianid);
                    string curnt_valuetechid = Convert.ToString(drpTechnician.SelectedValue);
                    // string Id = "";

                    //if (curnt_valuetechid == "11740" && prev_valuetechid!="11740")
                    if (IsSLANeedsToBeStopped(curnt_valuetechid) == 1 && IsSLANeedsToBeStopped(prev_valuetechid) == 0)
                    {
                        string StatusCurrent = GetStatusString(Convert.ToInt32(drpStatus.SelectedValue));
                        if (StatusCurrent.ToLower() != strStatusOnHold.ToLower())
                        {
                            //insert start time

                            if (StatusCurrent.ToLower() != strStatusOnHold.ToLower())
                            {
                                columnName = Resources.MessageResource.strColumnStarttime.ToString();
                                prev_value = "0";
                                curnt_value = DateTime.Now.ToString();
                                objIncidentHistoryDiff.Historyid = historyid;
                                objIncidentHistoryDiff.Columnname = columnName;
                                objIncidentHistoryDiff.Current_value = curnt_value;
                                objIncidentHistoryDiff.Prev_value = prev_value;
                                objIncidentHistoryDiff.Insert();
                                //end
                            }
                            //insert techcianid
                            objIncidentHistoryDiff.Historyid = historyid;
                            objIncidentHistoryDiff.Columnname = columnNametechid;
                            objIncidentHistoryDiff.Current_value = curnt_valuetechid;
                            objIncidentHistoryDiff.Prev_value = prev_valuetechid;
                            objIncidentHistoryDiff.Insert();
                            //end
                            //insert assigntime
                            if (objIncidentStatesOld.AssignedTime == null)
                            {
                                columnName = Resources.MessageResource.strColumnAssignedTime.ToString();
                                prev_value = "0";
                                curnt_value = DateTime.Now.ToString();
                                objIncidentHistoryDiff.Historyid = historyid;
                                objIncidentHistoryDiff.Columnname = columnName;
                                objIncidentHistoryDiff.Current_value = curnt_value;
                                objIncidentHistoryDiff.Prev_value = prev_value;
                                objIncidentHistoryDiff.Insert();
                            }
                            else
                            {
                                columnName = "AssignedTime";
                                prev_value = objIncidentStatesOld.AssignedTime;
                                curnt_value = DateTime.Now.ToString();
                                objIncidentHistoryDiff.Historyid = historyid;
                                objIncidentHistoryDiff.Columnname = columnName;
                                objIncidentHistoryDiff.Current_value = curnt_value;
                                objIncidentHistoryDiff.Prev_value = prev_value;
                                objIncidentHistoryDiff.Insert();
                            }
                            //end
                        }
                    }

                    else
                    {
                        //if prev value- progress eng
                        columnName = Resources.MessageResource.strColumnTechnicianid.ToString();
                        prev_value = Convert.ToString(objIncidentStatesOld.Technicianid);
                        curnt_value = Convert.ToString(drpTechnician.SelectedValue);
                        objIncidentHistoryDiff.Historyid = historyid;
                        objIncidentHistoryDiff.Columnname = columnName;
                        objIncidentHistoryDiff.Current_value = curnt_value;
                        objIncidentHistoryDiff.Prev_value = prev_value;
                        objIncidentHistoryDiff.Insert();

                        if (objIncidentStatesOld.AssignedTime == null)
                        {
                            columnName = Resources.MessageResource.strColumnAssignedTime.ToString();
                            prev_value = "0";
                            curnt_value = DateTime.Now.ToString();
                            objIncidentHistoryDiff.Historyid = historyid;
                            objIncidentHistoryDiff.Columnname = columnName;
                            objIncidentHistoryDiff.Current_value = curnt_value;
                            objIncidentHistoryDiff.Prev_value = prev_value;
                            objIncidentHistoryDiff.Insert();
                        }
                        else
                        {
                            columnName = "AssignedTime";
                            prev_value = objIncidentStatesOld.AssignedTime;
                            curnt_value = DateTime.Now.ToString();
                            objIncidentHistoryDiff.Historyid = historyid;
                            objIncidentHistoryDiff.Columnname = columnName;
                            objIncidentHistoryDiff.Current_value = curnt_value;
                            objIncidentHistoryDiff.Prev_value = prev_value;
                            objIncidentHistoryDiff.Insert();
                        }
                        // if (prev_valuetechid == "11740")
                        if (IsSLANeedsToBeStopped(prev_valuetechid) == 1)
                        {
                            string StatusCurrent = GetStatusString(Convert.ToInt32(drpStatus.SelectedValue));
                            if (StatusCurrent.ToLower() != strStatusOnHold.ToLower())
                            {
                                columnName = Resources.MessageResource.srColumnEndtime.ToString();
                                prev_value = "0";
                                curnt_value = DateTime.Now.ToString();
                                objIncidentHistoryDiff.Historyid = historyid;
                                objIncidentHistoryDiff.Columnname = columnName;
                                objIncidentHistoryDiff.Current_value = curnt_value;
                                objIncidentHistoryDiff.Prev_value = prev_value;
                                objIncidentHistoryDiff.Insert();
                            }
                            //end
                        }
                        //then insert end time 0
                        //end
                        //else
                        //end
                    }

                    if (Convert.ToInt32(drpTechnician.SelectedValue) != 0)
                    {
                        objSentMailtoUser.SentmailTechnician(Convert.ToInt32(drpTechnician.SelectedValue), objIncidentOld.Incidentid);
                    }
                    FlagTechnicianId = true;
                }
                #endregion

                #region If External Ticket value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentOld.ExternalTicketNo == null)
                { objIncidentOld.ExternalTicketNo = " "; }

                if (objIncidentOld.ExternalTicketNo.ToString().Trim() != txtExternalTicket.Text.ToString().Trim())
                {
                    //////////////////////////////////////////////////change done by meenakshi
                     int flag = Convert.ToInt32(Session["flag"]);
                     if (flag == 1)
                     {
                         columnName = Resources.MessageResource.strColumnExternalTicket.ToString();
                         prev_value = objIncidentOld.ExternalTicketNo.ToString().Trim();
                         txtExternalTicket.Text = (string)Session["compname"];
                         curnt_value = txtExternalTicket.Text.ToString().Trim();
                         //curnt_value =(string) Session["compname"];
                         objIncidentHistoryDiff.Historyid = historyid;
                         objIncidentHistoryDiff.Columnname = columnName;
                         objIncidentHistoryDiff.Current_value = curnt_value;
                         objIncidentHistoryDiff.Prev_value = prev_value;
                         objIncidentHistoryDiff.Insert();
                     }
                }
                #endregion

                #region If Vendor  value is changed,Insert into IncidentHistoryDiff table
                if (objIncidentOld.VendorId == null)
                { objIncidentOld.ExternalTicketNo = "0"; }

                if (objIncidentOld.VendorId != Convert.ToInt32(drpVendor.SelectedValue))
                {
                    columnName = Resources.MessageResource.strColumnVendorId.ToString();
                    prev_value = Convert.ToString(objIncidentOld.VendorId);
                    curnt_value = Convert.ToString(drpVendor.SelectedValue);
                    objIncidentHistoryDiff.Historyid = historyid;
                    objIncidentHistoryDiff.Columnname = columnName;
                    objIncidentHistoryDiff.Current_value = curnt_value;
                    objIncidentHistoryDiff.Prev_value = prev_value;
                    objIncidentHistoryDiff.Insert();
                }
                #endregion

                #region Check  Old status is closed and current status is closed,then Assign value to localvariable FlagCloseStatus=true and used later
                OldStatusString = GetStatusString(objIncidentStatesOld.Statusid);
                strCreateDatetime = objIncidentOld.Createdatetime;
                if (strStatusClose.ToLower() == OldStatusString.ToLower() && statusString.ToLower() == strStatusClose.ToLower())
                {
                    FlagCloseStatus = true;
                    oldCompletedTime = objIncidentOld.Completedtime;
                }
                #endregion

            }
            #endregion
        }

        if (FlagClosedStatus == true)
        {
            #region Update values in Incident Table
            objIncident.Incidentid = incidentid;
            objIncident.Siteid = Convert.ToInt32(drpSite.SelectedValue);
            objIncident.Deptid = Convert.ToInt32(drpDepartment.SelectedValue);
            objIncident.Title = lblTitle.Text;
            objIncident.Description = lblDescription.Text;
            objIncident.Modeid = Convert.ToInt32(drpMode.SelectedValue);
            objIncident.Slaid = SLAid;
            objIncident.Active = true;
            if (drpAMCCall.Text.ToUpper() == "YES")
            {
                objIncident.AMCCall = true;
            }
            else if (drpAMCCall.Text.ToUpper() == "NO")
            {
                objIncident.AMCCall = false;
            }
        /////////////////////////////////////////////////////////////////change done by meenakshi/////////////////////////
            //objIncident.ExternalTicketNo = txtExternalTicket.Text.ToString().Trim();
            objIncident.ExternalTicketNo = (string)(Session["compname"]);
        /////////////////////////////////////////////////////////////////end/////////////////////////////////
            objIncident.VendorId = Convert.ToInt32(drpVendor.SelectedValue);
            //#region If Current status is closed,then Assign Completed time
            #region If Current status is resolved,then Assign Completed time
            if (statusString.ToLower() == strStatusResolved.ToLower())
            {
                #region If FlagCloseStatus=flase ie Currrent status is closed ,and old status is not Closed
                if (FlagCloseStatus == false)
                {
                    objIncident.Completedtime = DateTime.Now.ToString();
                    varTotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(incidentid, Convert.ToInt32(drpSite.SelectedValue), strCreateDatetime, DateTime.Now.ToString());
                }
                else
                {
                    objIncident.Completedtime = oldCompletedTime;
                    varTotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(incidentid, Convert.ToInt32(drpSite.SelectedValue), strCreateDatetime, oldCompletedTime);
                }
                #endregion
            }
            //added by lalit 27 march
            if (statusString.ToLower() == strStatusClose.ToLower())
            {
                #region If FlagCloseStatus=flase ie Currrent status is closed ,and old status is not Closed
                varTotalTimeSpentonCall = objIncident.Timespentonreq;
                objIncident.Completedtime = oldCompletedTime;
                #endregion
            }
            //end lalit
            if (varTotalTimeSpentonCall <= 0)
            {
                varTotalTimeSpentonCall = 0;
            }

            if (lblextension.Text != "")
            {

                objIncident.Extension = Convert.ToInt64(lblextension.Text);
            }
            //if (lblAMCcall.Text != "")
            //{

            //    objIncident.AMCCall = Convert.ToInt32(lblAMCcall.Text);
            //}
            objIncident.Timespentonreq = varTotalTimeSpentonCall;
            objIncident.Update();
            //if (statusString.ToLower() == strStatusClose.ToLower() && FlagClosedStatus == true)
            if (statusString.ToLower() == strStatusResolved.ToLower() && FlagClosedStatus == true)
            {
                objSentMailtoUser.SentmailUser(objIncidentOld.Requesterid, objIncidentOld.Incidentid, "closed");
            }
            #endregion
            #endregion
        }
        if (FlagClosedStatus == true)
        {
            #region Update Values in IncidentStates
            objIncidentStates.Incidentid = incidentid;
            objIncidentStates.Categoryid = Convert.ToInt32(drpCategory.SelectedValue);
            objIncidentStates.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue);
            objIncidentStates.Technicianid = Convert.ToInt32(drpTechnician.SelectedValue);
            if (FlagTechnicianId == true)
            {
                objIncidentStates.AssignedTime = DateTime.Now.ToString();

            }
            objIncidentStates.Statusid = Convert.ToInt32(drpStatus.SelectedValue);
            objIncidentStates.Priorityid = Convert.ToInt32(drpPriority.SelectedValue);
            objIncidentStates.Requesttypeid = Convert.ToInt32(drpRequestType.SelectedValue);
            objIncidentStates.Update();
            #endregion
        }
            #region Callint Updatepanel1() function to display value in Non Editable Mode
        UpdatePanel1();
        #endregion
        HistoryUpdatePanel();
    }