コード例 #1
0
        public void TestCloseIncidentRequestFailsWhenStatusMissing()
        {
            var incident = new Incident();

            incident.Id = orgAdminUIService.Create(incident);

#if (XRM_MOCKUP_TEST_2011 || XRM_MOCKUP_TEST_2013)
            incident.SetState(orgAdminService, IncidentState.Active, Incident_StatusCode.InProgress);
#else
            incident.StateCode  = IncidentState.Active;
            incident.StatusCode = Incident_StatusCode.InProgress;
            orgAdminUIService.Update(incident);
#endif

            var incidentResolution = new IncidentResolution
            {
                IncidentId = incident.ToEntityReference(),
                Subject    = "Resolved Incident"
            };

            var request = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
            };

            try
            {
                orgAdminUIService.Execute(request);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.IsInstanceOfType(e, typeof(FaultException));
            }
        }
コード例 #2
0
        public bool ResolveCase(Incident incident)
        {
            try
            {
                //Create Incident Resolution
                var incidentResolution = new IncidentResolution
                {
                    Subject    = "Case Resolved",
                    IncidentId = new EntityReference(Incident.EntityLogicalName, incident.Id),
                    ActualEnd  = DateTime.Now
                };

                //Close Incident
                var closeIncidenRequst = new CloseIncidentRequest
                {
                    IncidentResolution = incidentResolution,
                    Status             = new OptionSetValue(5)
                };

                _service.Execute(closeIncidenRequst);
                _log.Info($"Successfully resolved case {incident.TicketNumber} with id {incident.Id}");
                return(true);
            }
            catch (Exception ex)
            {
                _log.Error($"Exception caught during resolving case {incident.TicketNumber} with id {incident.Id} - {ex.Message}");
                return(false);
            }
        }
        private void CloseIncident(EntityReference caseReference)
        {
            // First close the Incident

            // Create resolution for the closing incident
            IncidentResolution resolution = new IncidentResolution
            {
                Subject = "Case Closed",
            };

            resolution.IncidentId = caseReference;

            // Create the request to close the incident, and set its resolution to the
            // resolution created above
            CloseIncidentRequest closeRequest = new CloseIncidentRequest();

            closeRequest.IncidentResolution = resolution;

            // Set the requested new status for the closed Incident
            closeRequest.Status =
                new OptionSetValue((int)incident_statuscode.ProblemSolved);

            // Execute the close request
            CloseIncidentResponse closeResponse =
                (CloseIncidentResponse)_serviceProxy.Execute(closeRequest);

            //Check if the incident was successfully closed
            Incident incident = _serviceProxy.Retrieve(Incident.EntityLogicalName,
                                                       _caseIncidentId, new ColumnSet(allColumns: true)).ToEntity <Incident>();

            if (incident.StateCode.HasValue & amp; &amp;
                incident.StateCode == IncidentState.Resolved)
            {
                Console.WriteLine("The incident was closed out as Resolved.");
            }
コード例 #4
0
ファイル: TestIncident.cs プロジェクト: delegateas/XrmMockup
        public void TestCloseIncidentRequestFailsWhenIncidentDoesNotExist()
        {
            var incident = new Incident();

            var incidentResolution = new IncidentResolution
            {
                IncidentId = incident.ToEntityReference(),
                Subject    = "Resolved Incident"
            };

            var request = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.InformationProvided)
            };

            try
            {
                orgAdminUIService.Execute(request);
                throw new XunitException();
            }
            catch (Exception e)
            {
                Assert.IsType <FaultException>(e);
            }
        }
コード例 #5
0
        public void TestCloseIncidentRequestSuccess()
        {
            var incident = new Incident();

            incident.Id = orgAdminUIService.Create(incident);

#if (XRM_MOCKUP_TEST_2011 || XRM_MOCKUP_TEST_2013)
            incident.SetState(orgAdminService, IncidentState.Active, Incident_StatusCode.InProgress);
#else
            incident.StateCode  = IncidentState.Active;
            incident.StatusCode = Incident_StatusCode.InProgress;
            orgAdminUIService.Update(incident);
#endif
            var incidentResolution = new IncidentResolution
            {
                IncidentId = incident.ToEntityReference(),
                Subject    = "Resolved Incident"
            };

            var request = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            var response = orgAdminUIService.Execute(request) as CloseIncidentResponse;
            Assert.IsNotNull(response);
        }
コード例 #6
0
ファイル: TestIncident.cs プロジェクト: delegateas/XrmMockup
        public void TestCloseIncidentRequestFailsWhenIncidentidMissing()
        {
            var incident = new Incident();

            incident.Id = orgAdminUIService.Create(incident);

#if (XRM_MOCKUP_TEST_2011 || XRM_MOCKUP_TEST_2013)
            incident.SetState(orgAdminService, IncidentState.Active, Incident_StatusCode.InProgress);
#else
            incident.StateCode  = IncidentState.Active;
            incident.StatusCode = Incident_StatusCode.InProgress;
            orgAdminUIService.Update(incident);
#endif

            var incidentResolution = new IncidentResolution
            {
                Subject = "Resolved Incident"
            };

            var request = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            try
            {
                orgAdminUIService.Execute(request);
                throw new XunitException();
            }
            catch (Exception e)
            {
                Assert.IsType <FaultException>(e);
            }
        }
コード例 #7
0
ファイル: TestIncident.cs プロジェクト: delegateas/XrmMockup
        public void TestUpdateResolvedIncidentSucceedsWhenFieldModificationIsAllowed()
        {
            var incident = new Incident()
            {
                Title = "Old Title",
            };

            incident.Id = orgAdminService.Create(incident);

            var resolution = new IncidentResolution
            {
                Subject    = "Case closed",
                IncidentId = incident.ToEntityReference()
            };

            var closeRequest = new CloseIncidentRequest()
            {
                IncidentResolution = resolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            orgAdminService.Execute(closeRequest);

            var incidentUpdate = new Incident(incident.Id)
            {
                StateCode = IncidentState.Active
            };

            orgAdminService.Update(incidentUpdate);

            var retrievedIncident = Incident.Retrieve(orgAdminService, incident.Id);

            Assert.Equal(IncidentState.Active, retrievedIncident.StateCode);
        }
コード例 #8
0
ファイル: TestIncident.cs プロジェクト: delegateas/XrmMockup
        public void TestCloseIncidentRequestFailsWhenPreviouslyResolved()
        {
            var incident = new Incident();

            incident.Id = orgAdminUIService.Create(incident);

#if (XRM_MOCKUP_TEST_2011 || XRM_MOCKUP_TEST_2013)
            incident.SetState(orgAdminService, IncidentState.Active, Incident_StatusCode.InProgress);
#else
            incident.StateCode  = IncidentState.Active;
            incident.StatusCode = Incident_StatusCode.InProgress;
            orgAdminUIService.Update(incident);
#endif
            var incidentResolution = new IncidentResolution
            {
                IncidentId = incident.ToEntityReference(),
                Subject    = "Resolved Incident"
            };

            var request = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            var response = orgAdminUIService.Execute(request) as CloseIncidentResponse;
            Assert.NotNull(response);

            using (var context = new Xrm(orgAdminUIService))
            {
                var retrievedIncident = context.IncidentSet.FirstOrDefault(x => x.Id == incident.Id);
                Assert.Equal(IncidentState.Resolved, retrievedIncident.StateCode);
                Assert.Equal(Incident_StatusCode.ProblemSolved, retrievedIncident.StatusCode);

                var retrievedIncidentResolution = context.IncidentResolutionSet.FirstOrDefault(x => x.IncidentId.Id == incident.Id);
                Assert.NotNull(retrievedIncidentResolution);
            }

            var incidentResolution2 = new IncidentResolution
            {
                IncidentId = incident.ToEntityReference(),
                Subject    = "Resolved Incident"
            };

            var request2 = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution2,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            try
            {
                orgAdminUIService.Execute(request2);
                throw new XunitException();
            }
            catch (Exception e)
            {
                Assert.IsType <FaultException>(e);
            }
        }
コード例 #9
0
        private void ResolveCase(IExtendedExecutionContext context, Incident latestCase)
        {
            // Change the case built-in status and status reason to Resolved and Problem solved respectively on the latest case created.
            // Change the Change Email Status to Approved on the latest case created.
            latestCase[ChangeEmailStatus] = new OptionSetValue(100000004); //Approved
            latestCase[SubStatusReason]   = new OptionSetValue(100000002); //Approved - Confirmed
            context.OrganizationService.Update(latestCase);

            // Create Incident Resolution
            var incidentResolutionResolved = new IncidentResolution
            {
                Subject    = "Case Resolved",
                IncidentId = new EntityReference(Incident.EntityLogicalName, latestCase.Id),
                ActualEnd  = DateTime.Now
            };

            // Close Incident
            var closeIncidentRequestResolved = new CloseIncidentRequest
            {
                IncidentResolution = incidentResolutionResolved,
                Status             = new OptionSetValue(5)
            };

            context.OrganizationService.Execute(closeIncidentRequestResolved);
            context.Trace($"Set case status to Approved for Case with ID {latestCase.Id}");
        }
コード例 #10
0
        public bool ResolveCase(string incidentId)
        {
            log.Info($"{nameof(ResolveCase)} started. Case to resolve Id is {incidentId}");
            try
            {
                var incidentResolution = new IncidentResolution
                {
                    Subject    = "Resolve Request Incident",
                    IncidentId = new EntityReference(Incident.EntityLogicalName, Guid.Parse(incidentId))
                };

                var closeIncidentRequest = new CloseIncidentRequest
                {
                    IncidentResolution = incidentResolution,
                    RequestName        = "Resolve Case",
                    Status             = new OptionSetValue(5) //resolve case
                };

                var response = crmConnection.Service.Execute(closeIncidentRequest);
                log.Info("Incident Closed");

                return(true);
            }
            catch (Exception ex)
            {
                log.Error($"{nameof(ResolveCase)} throws exception: {ex.Message}");
                Console.WriteLine(ex.Message);

                return(false);
            }
        }
コード例 #11
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();
    }
    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();
    }
コード例 #13
0
        public void ResolveCase(Guid caseId)
        {
            try
            {
                using (var context = new XrmServiceContext(_service))
                {
                    _log.Info($"Executing resolve case for case with id {caseId}");

                    Incident selectedCase = (from incident in context.IncidentSet
                                             where incident.IncidentId.Equals(caseId)
                                             select incident)
                                            .FirstOrDefault();

                    if (selectedCase == null)
                    {
                        _log.Info($"No case found with id {caseId}");
                        return;
                    }

                    var statuses = (from status in context.New_requeststatusSet
                                    select status)
                                   .ToList();

                    //Set case status to "Completed"
                    selectedCase.new_caseid.Id = statuses[0].Id;

                    //Create Incident Resolution
                    var incidentResolution = new IncidentResolution
                    {
                        Subject    = "Case Resolved",
                        IncidentId = new EntityReference(Incident.EntityLogicalName, selectedCase.Id),
                        ActualEnd  = DateTime.Now
                    };

                    //Close Incident
                    var closeIncidenRequst = new CloseIncidentRequest
                    {
                        IncidentResolution = incidentResolution,
                        Status             = new OptionSetValue(5)
                    };

                    _service.Execute(closeIncidenRequst);

                    context.UpdateObject(selectedCase);
                    context.SaveChanges();
                    _log.Info($"Set case status to Completed for Case with ID {caseId}");
                }
            }
            catch (Exception ex)
            {
                _log.Error($"Exception caught while trying to resolve case with ID {caseId} - {ex.Message}");
            }
        }
コード例 #14
0
        //Under Dev
        public bool ResolveIncident(string ticketId)
        {
            var service = this.db.Connect();

            try
            {
                using (ServiceContext context = new ServiceContext(service))
                {
                    var caseToResolve = (from incident in context.IncidentSet
                                         //join caseStatus in context.New_requeststatusSet on incident.new_caseid.Id equals caseStatus.New_requeststatusId
                                         where incident.TicketNumber.Equals(ticketId)
                                         select incident
                                         )
                                        .FirstOrDefault();

                    var statusesInCrm = (from status in context.New_requeststatusSet
                                         select status)
                                        .ToList();

                    //Change ticket CaseStatus to Completed
                    caseToResolve.new_caseid.Id = statusesInCrm[0].Id;

                    context.UpdateObject(caseToResolve);
                    context.SaveChanges();


                    var incidentResolution = new IncidentResolution
                    {
                        Subject    = "Case Resolved",
                        IncidentId = new EntityReference(Incident.EntityLogicalName, caseToResolve.Id),
                        ActualEnd  = DateTime.Now,
                    };

                    var closeIncidenRequst = new CloseIncidentRequest
                    {
                        IncidentResolution = incidentResolution,
                        Status             = new OptionSetValue(5) //new OptionSetValue((int))
                    };

                    var response = (CloseIncidentResponse)service.Execute(closeIncidenRequst);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception throw during changing status of Ticket: {ex.Message}");
                return(false);
            }


            return(true);
        }
        public async Task <IncidentDto> PatchIncident(string id, Delta <IncidentDto> patch)
        {
            /*var current = (await this.LookupAsync(id)).Queryable.First();
             * this.Services.Log.Info("Current item: " + current.Id + ",  '" + current.Text + "', completed: " + current.Complete.ToString());
             * patch.Patch(current);
             * this.Services.Log.Info("Patch simulation: " + current.Id + ",  '" + current.Text + "', completed: " + current.Complete.ToString());*/

            if (patch.GetChangedPropertyNames().Contains("Complete") == true)
            {
                this.Services.Log.Info("resolving the case");
                Guid entityId;
                if (!Guid.TryParse(id, out entityId))
                {
                    return(null);
                }

                //case resolution requires special handling
                var incidentResolution = new IncidentResolution()
                {
                    Subject    = "Resolved Incident",
                    IncidentId = new EntityReference(Incident.EntityLogicalName, entityId)
                };
                var closeIncidentRequest = new CloseIncidentRequest()
                {
                    IncidentResolution = incidentResolution,
                    Status             = new OptionSetValue(5)
                };

                await this.DynamicsCrmDomainManager.Execute(closeIncidentRequest);

                return((await this.LookupAsync(id)).Queryable.First());
            }
            else
            {
                var item = await this.UpdateAsync(id, patch);

                this.Services.Log.Info("Updated item: " + item.Id + ",  '" + item.Text + "', completed: " + item.Complete.ToString());

                /*Incident incident = this.EntityMapper.Map(item);
                 * this.Services.Log.Info("Updated incident: " + incident.Id.ToString() + ",  '" + incident.Title + "', completed: " + incident.StatusCode.Value.ToString());*/
                return(item);
            }
        }
コード例 #16
0
ファイル: TestIncident.cs プロジェクト: delegateas/XrmMockup
        public void TestUpdateResolvedIncidentFailsWhenFieldModificationIsNotAllowed()
        {
            var incident = new Incident()
            {
                Title = "Old Title"
            };

            incident.Id = orgAdminService.Create(incident);

            var resolution = new IncidentResolution
            {
                Subject    = "Case closed",
                IncidentId = incident.ToEntityReference()
            };

            var closeRequest = new CloseIncidentRequest()
            {
                IncidentResolution = resolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            orgAdminService.Execute(closeRequest);

            var incidentUpdate = new Incident(incident.Id)
            {
                Title = "New Title"
            };

            try
            {
                orgAdminService.Update(incidentUpdate);
                throw new XunitException();
            }
            catch (Exception e)
            {
                Assert.IsType <FaultException>(e);
            }

            var retrievedIncident = Incident.Retrieve(orgAdminService, incident.Id);

            Assert.Equal(incident.Title, retrievedIncident.Title);
        }
コード例 #17
0
        public async Task <bool> Resolve(int currentIndex, int maxCount, Guid incidentId, bool isPrintingProgress)
        {
            bool isOperationSuccessfull = false;

            var ctx           = DcrmConnectorFactory.GetContext();
            var dcrmConnector = DcrmConnectorFactory.Get();
            var srv           = dcrmConnector.GetService();
            var incident      = new EntityReference(Incident.EntityLogicalName, incidentId);

            IncidentResolution incidentResolution = new IncidentResolution
            {
                IncidentId = incident,
                StatusCode = new OptionSetValue(5)
            };

            CloseIncidentRequest closeIncidentReq = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue(5)
            };

            try
            {
                ctx.Execute(closeIncidentReq);
                if (isPrintingProgress)
                {
                    MiscHelper.DisplayProgression(maxCount);
                }

                isOperationSuccessfull = true;
            }
            catch (Exception ex)
            {
                var message = string.Format($"Could not close the incident : {incidentId} : {ex.Message} ");
                MiscHelper.PrintMessage(message);
            }

            return(isOperationSuccessfull);
        }
コード例 #18
0
        public void TestCloseIncidentRequestSuccess()
        {
            var incident = new Incident();

            incident.Id = orgAdminUIService.Create(incident);

#if (XRM_MOCKUP_TEST_2011 || XRM_MOCKUP_TEST_2013)
            incident.SetState(orgAdminService, IncidentState.Active, Incident_StatusCode.InProgress);
#else
            incident.StateCode  = IncidentState.Active;
            incident.StatusCode = Incident_StatusCode.InProgress;
            orgAdminUIService.Update(incident);
#endif
            var incidentResolution = new IncidentResolution
            {
                IncidentId = incident.ToEntityReference(),
                Subject    = "Resolved Incident"
            };

            var request = new CloseIncidentRequest()
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue((int)Incident_StatusCode.ProblemSolved)
            };

            var response = orgAdminUIService.Execute(request) as CloseIncidentResponse;
            Assert.IsNotNull(response);

            using (var context = new Xrm(orgAdminUIService))
            {
                var retrievedIncident = context.IncidentSet.FirstOrDefault(x => x.Id == incident.Id);
                Assert.AreEqual(IncidentState.Resolved, retrievedIncident.StateCode);
                Assert.AreEqual(Incident_StatusCode.ProblemSolved, retrievedIncident.StatusCode);

                var retrievedIncidentResolution = context.IncidentResolutionSet.FirstOrDefault(x => x.IncidentId.Id == incident.Id);
                Assert.IsNotNull(retrievedIncidentResolution);
            }
        }
コード例 #19
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();
            //}
        }
    }
        public void Execute(IServiceProvider serviceProvider)
        {
            IPluginExecutionContext     context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService        service = factory.CreateOrganizationService(context.UserId);

            try
            {
                //Get the twitter credentials from CRM
                QueryExpression query = new QueryExpression();
                query.EntityName = "syt_twittercredential";
                query.ColumnSet  = new ColumnSet()
                {
                    AllColumns = true
                };
                EntityCollection entities = service.RetrieveMultiple(query);
                Entity           entity   = entities[0];


                //Get the details of the message to be updated
                string tweetactivityid = context.InputParameters["Retweetid"].ToString();
                string message         = context.InputParameters["Message"].ToString();
                var    arr             = tweetactivityid.Split(' ');
                var    twithandle      = arr[1];
                var    tweetid         = arr[0];
                var    guid            = arr[2];

                string twitterURL = "https://api.twitter.com/1.1/statuses/update.json";

                //set the access tokens (REQUIRED)
                string oauth_consumer_key    = entity.Attributes["syt_consumerkey"].ToString();
                string oauth_consumer_secret = entity.Attributes["syt_consumersecret"].ToString();
                string oauth_token           = entity.Attributes["syt_accesstoken"].ToString();
                string oauth_token_secret    = entity.Attributes["syt_accesstokensecret"].ToString();

                // set the oauth version and signature method
                string oauth_version          = "1.0";
                string oauth_signature_method = "HMAC-SHA1";

                // create unique request details
                string          oauth_nonce     = Convert.ToBase64String(new ASCIIEncoding().GetBytes(DateTime.Now.Ticks.ToString()));
                System.TimeSpan timeSpan        = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
                string          oauth_timestamp = Convert.ToInt64(timeSpan.TotalSeconds).ToString();

                // create oauth signature
                string baseFormat = "oauth_consumer_key={0}&oauth_nonce={1}&oauth_signature_method={2}" + "&oauth_timestamp={3}&oauth_token={4}&oauth_version={5}&status={6}";

                string baseString = string.Format(
                    baseFormat,
                    oauth_consumer_key,
                    oauth_nonce,
                    oauth_signature_method,
                    oauth_timestamp, oauth_token,
                    oauth_version,
                    Uri.EscapeDataString(message + " https://twitter.com/" + twithandle + "/status/" + tweetid)
                    );

                string oauth_signature = null;
                using (HMACSHA1 hasher = new HMACSHA1(ASCIIEncoding.ASCII.GetBytes(Uri.EscapeDataString(oauth_consumer_secret) + "&" + Uri.EscapeDataString(oauth_token_secret))))
                {
                    oauth_signature = Convert.ToBase64String(hasher.ComputeHash(ASCIIEncoding.ASCII.GetBytes("POST&" + Uri.EscapeDataString(twitterURL) + "&" + Uri.EscapeDataString(baseString))));
                }

                // create the request header
                string authorizationFormat = "OAuth oauth_consumer_key=\"{0}\", oauth_nonce=\"{1}\", " + "oauth_signature=\"{2}\", oauth_signature_method=\"{3}\", " + "oauth_timestamp=\"{4}\", oauth_token=\"{5}\", " + "oauth_version=\"{6}\"";

                string authorizationHeader = string.Format(
                    authorizationFormat,
                    Uri.EscapeDataString(oauth_consumer_key),
                    Uri.EscapeDataString(oauth_nonce),
                    Uri.EscapeDataString(oauth_signature),
                    Uri.EscapeDataString(oauth_signature_method),
                    Uri.EscapeDataString(oauth_timestamp),
                    Uri.EscapeDataString(oauth_token),
                    Uri.EscapeDataString(oauth_version)
                    );

                HttpWebRequest objHttpWebRequest = (HttpWebRequest)WebRequest.Create(twitterURL);
                objHttpWebRequest.Headers.Add("Authorization", authorizationHeader);
                objHttpWebRequest.Method      = "POST";
                objHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
                using (Stream objStream = objHttpWebRequest.GetRequestStream())
                {
                    byte[] content = ASCIIEncoding.ASCII.GetBytes("status=" + Uri.EscapeDataString(message + " https://twitter.com/" + twithandle + "/status/" + tweetid));
                    objStream.Write(content, 0, content.Length);
                }

                var responseResult = "";
                try
                {
                    //success posting
                    WebResponse  objWebResponse  = objHttpWebRequest.GetResponse();
                    StreamReader objStreamReader = new StreamReader(objWebResponse.GetResponseStream());
                    responseResult = objStreamReader.ReadToEnd().ToString();
                }
                catch (Exception ex)
                {
                    //throw exception error
                    responseResult = "Twitter Post Error: " + ex.Message.ToString() + ", authHeader: " + authorizationHeader;
                }

                SetStateRequest _SetStateReq = new SetStateRequest();
                if (arr[3] == "syt_tweet")//if retweeted from an activity
                {
                    _SetStateReq.EntityMoniker = new EntityReference("syt_tweet", new Guid(guid));
                    _SetStateReq.State         = new OptionSetValue(1);
                    _SetStateReq.Status        = new OptionSetValue(2);
                    SetStateResponse _SetStateResp = (SetStateResponse)service.Execute(_SetStateReq);
                }
                else if (arr[3] == "incident")//if retweeted from a case
                {
                    //_SetStateReq.EntityMoniker = new EntityReference("incident", new Guid(guid));
                    //_SetStateReq.State = new OptionSetValue(2);
                    //_SetStateReq.Status = new OptionSetValue(6);
                    //SetStateResponse _SetStateResp = (SetStateResponse)service.Execute(_SetStateReq);
                    IncidentResolution res = new IncidentResolution
                    {
                        IncidentId = new EntityReference
                        {
                            LogicalName = Incident.EntityLogicalName,
                            Id          = new Guid(guid)
                        }
                    };

                    CloseIncidentRequest request = new CloseIncidentRequest
                    {
                        IncidentResolution = res,
                        Status             = new OptionSetValue(5) //Problem Solved
                    };

                    service.Execute(request);
                }
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(ex.Message);
            }
        }
コード例 #21
0
        private static void RunIncidentManipulation(CrmServiceClient service)
        {
            Console.WriteLine("=== Creating and Closing an Incident (Case) ===");

            // Create an incident.
            var incident = new Incident
            {
                CustomerId = new EntityReference(Account.EntityLogicalName, _accountId),
                Title      = "Sample Incident"
            };

            _incidentId = service.Create(incident);
            NotifyEntityCreated(Incident.EntityLogicalName, _incidentId);

            // Create a 30-minute appointment regarding the incident.
            var appointment = new Appointment
            {
                ScheduledStart    = DateTime.Now,
                ScheduledEnd      = DateTime.Now.Add(new TimeSpan(0, 30, 0)),
                Subject           = "Sample 30-minute Appointment",
                RegardingObjectId = new EntityReference(Incident.EntityLogicalName,
                                                        _incidentId)
            };

            _appointmentId = service.Create(appointment);
            NotifyEntityCreated(Appointment.EntityLogicalName, _appointmentId);

            // Show the time spent on the incident before closing the appointment.
            NotifyTimeSpentOnIncident(service);
            // Check the validity of the state transition to closed on the incident.
            NotifyValidityOfIncidentSolvedStateChange(service);
            // Close the appointment.
            var setAppointmentStateReq = new SetStateRequest
            {
                EntityMoniker = new EntityReference(Appointment.EntityLogicalName,
                                                    _appointmentId),
                State  = new OptionSetValue((int)AppointmentState.Completed),
                Status = new OptionSetValue((int)appointment_statuscode.Completed)
            };

            service.Execute(setAppointmentStateReq);

            Console.WriteLine("  Appointment state set to completed.");

            // Show the time spent on the incident after closing the appointment.
            NotifyTimeSpentOnIncident(service);
            // Check the validity of the state transition to closed again.
            NotifyValidityOfIncidentSolvedStateChange(service);

            // Create the incident's resolution.
            var incidentResolution = new IncidentResolution
            {
                Subject    = "Resolved Sample Incident",
                IncidentId = new EntityReference(Incident.EntityLogicalName, _incidentId)
            };

            // Close the incident with the resolution.
            var closeIncidentRequest = new CloseIncidentRequest
            {
                IncidentResolution = incidentResolution,
                Status             = new OptionSetValue((int)incident_statuscode.ProblemSolved)
            };

            service.Execute(closeIncidentRequest);

            Console.WriteLine("  Incident closed.");
        }
コード例 #22
0
        public bool ResolveCase(string ticketId)
        {
            if (string.IsNullOrEmpty(ticketId))
            {
                Log.Error($"{SERVICE} {RESOLVE_CASES}. Ticket Id was find null or empty space.");
            }
            Log.Info($"{SERVICE} {RESOLVE_CASES}. To resolve ticket id: {ticketId}");

            //var service = this.db.Connect();
            try
            {
                using (ServiceContext context = new ServiceContext(service))
                {
                    Log.Info($"{SERVICE} {GET_STUDENT_CASES}. Request for ticket {ticketId}");

                    var caseToResolve = (from incident in context.IncidentSet
                                         where incident.TicketNumber.Equals(ticketId)
                                         select incident
                                         )
                                        .FirstOrDefault();
                    if (caseToResolve == null)
                    {
                        Log.Error($"{SERVICE} {GET_STUDENT_CASES}. Ticket: {ticketId} was not found.");
                        return(false);
                    }

                    //Check if the Case is already CLOSED/RESOLVED
                    if (caseToResolve.new_caseid.Name == "Closed" || caseToResolve.new_caseid.Name == "Completed")
                    {
                        Log.Error($"{SERVICE} {GET_STUDENT_CASES}. Ticket: {ticketId} status is not Active and cannot be Resolved.");
                        return(false);
                    }
                    ;

                    //Retrieve the three type of statuses
                    var statusesInCrm = (from status in context.New_requeststatusSet
                                         select status)
                                        .ToList();

                    //Change ticket CaseStatus to Completed
                    caseToResolve.new_caseid.Id = statusesInCrm[0].Id;

                    Log.Info($"{SERVICE} {GET_STUDENT_CASES}. To Set ticket {ticketId} as completed");

                    context.UpdateObject(caseToResolve);
                    context.SaveChanges();


                    var incidentResolution = new IncidentResolution
                    {
                        Subject    = "Case Resolved",
                        IncidentId = new EntityReference(Incident.EntityLogicalName, caseToResolve.Id),
                        ActualEnd  = DateTime.Now
                    };
                    var closeIncidenRequst = new CloseIncidentRequest
                    {
                        IncidentResolution = incidentResolution,
                        Status             = new OptionSetValue(5)
                    };

                    Log.Info($"{SERVICE} {GET_STUDENT_CASES}. To resolve ticket {ticketId}");

                    service.Execute(closeIncidenRequst);
                }

                Log.Info($"{SERVICE} {GET_STUDENT_CASES}. Ticket: {ticketId} was resolved");
                return(true);
            }
            catch (Exception ex)
            {
                Log.Error($"Exception throw during resolving ticket wit id: {ticketId}", ex);
                return(false);
            }
        }
    protected void btnResolution_Click(object sender, EventArgs e)
    {
        /////Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            int userid = 0;
            string userName;
            MembershipUser User = Membership.GetUser();
            userName = User.UserName.ToString();

            if (userName != "")
            {

                objOrganization = objOrganization.Get_Organization();
                objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid);
                if (objUser.Userid != 0)
                {
                    userid = objUser.Userid;
                }
            }
            IncidentResolution objIncidentResolution = new IncidentResolution();
            #region Get incidentid from QueryString
            int incidentid = Convert.ToInt32(Request.QueryString[0]);
            #endregion
            #region Check Is Resolution Exist in Database
            objIncidentResolution = objIncidentResolution.Get_By_id(incidentid);
            #endregion
            #region Add Resolution  in Database

            string varResolution;
            varResolution = Editor.Text;
            objIncidentResolution.Incidentid = incidentid;
            objIncidentResolution.Lastupdatetime = DateTime.Now.ToString();
            objIncidentResolution.Resolution = varResolution;
            objIncidentResolution.Userid = userid;
            objIncidentResolution.Insert();
            Editor.Text = "";
            ShowResolution();

            #endregion
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }
    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);
        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.Subject = "Call Logged. Ticket Id : " + incidentid;
                    LogMessage("Call Open TicketId" + incidentid);
                    ///////////////////////////////////////////////////commented by meenakshi 2nd july 2013
                   // 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>ResolutionTime&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>";

                       ////////////////////////////////////////////////////end

                      string strBody = "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 ;
                        strBody = strBody + "<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 ;
                        strBody = strBody + "<br/><b>Logged Date & Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> " + objIncident.Createdatetime;
                        strBody = strBody + "<br/><b>Description</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:" + objIncident.Description;
                        strBody = strBody + "<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;
                        strBody = strBody + "<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;
                        strBody = strBody + "<br/><b>Email Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> " + objC_info.Emailid;
                        strBody = strBody + "<br/><b>ResolutionTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> " + GetResolutionTimeInHours(objIncident.Slaid);

                        if (objIncident.Siteid ==1)
                        {
                            //location = "1";
                            //contactnum = "9811801977";
                            //mailid = "*****@*****.**";
                            //techid = "16";
                            //cmd.CommandText = "insert into Incident_mst(Title, Timespentonreq, Slaid, Siteid, Requesterid, Modeid, Description, Deptid, Createdbyid, Createdatetime,Extension,Completedtime, ExternalTicketNo, VendorId,active,AMCCall ,Reporteddatetime)values(@Title, 0, 3, '" + location + "', 2, 5, @Description, 0, 2, @Createdatetime,0,null, null, 0,1, 0 ,@Reporteddatetime)";
                            //// SentMail("*****@*****.**", "*****@*****.**", subject, body);

                            //strBody = strBody + "<br/><br/>For any other support kindly get in touch with us at 9811801977.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";

                            strBody = strBody + "<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181  or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";

                        }
                        else if (objIncident.Siteid ==2)
                        {
                            strBody = strBody + "<br/><br/><b>For any other support, kindly get in touch with us at +912266326582 and 6587 or +91 9820831745 (24/7)<br/><br/> In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Name & Contact Details</b><br/><br/><b>Maruti Aldar : 6587</b><br/><b>Ranjana Kamle : 6587</b><br/><b>Brijesh Singh: 6587</b><br/>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b>  Trident NarimanPoint IT Support Desk, Ext. 6587 </b>";

                        }
                        else if (objIncident.Siteid == 3)
                        {
                            strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at +919930455789 and Extn:7411 / 7412, +917875551291 or at +912266727411/12<br/><br/> In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Tier 1:  Darshan Trivedi – (+91 9819404011)</b><br/><b>Tier 2: Sudhir Nate (+91 9930455714), Jignesh Patel (+91 9987228227)</b><br/><b>Tier 3: Apurv Sharma (+91 9930455781)</b>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident BandraKurla IT Support, Ext. 7411 / 7412 </b>";
                        }
                        else if (objIncident.Siteid == 4)
                        {
                            strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at +918041358518, Extn:8516 / 8517 or email at [email protected]<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Chethan Kumar. J</b><br/><b>[email protected]</b><br/><b>System Administrator</b>";
                            strBody = strBody + "<br/><b>91-9916033777</b><br/><br/><b>Yunus Khatib</b><br/><b>[email protected]</b><br/><b>Systems Manager</b><br/><b>91-9886058585</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Bangalore IT Support, Ext. 8546 / 8517 </b>";
                        }
                        else if (objIncident.Siteid == 5)
                        {
                            strBody = strBody + "<br/><br/> <b>For any other support kindly get in touch with us at +91 33 2249 2323 2323 or at +919831519900/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Arindam Banerjee </b><br/><b>Systems Manager</b><br/><b>The Oberoi Grand</b>";
                            strBody = strBody + "<br/><b>Email: [email protected]</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Grand Kolkata IT Support </b>";
                        }
                        else if (objIncident.Siteid == 6)
                        {
                            //strBody = strBody + "<br/><br/> <b>For any other support kindly get in touch with the </b><br/><br/><b>IT Support team on Extension 6252,Direct Number +91 40 6603 6252,Mobile Number + 91  88860 48662</b><br/><br/><b>Telephone Support staff  on  Extension 6253, Direct Number +91 40 6603 6253, Mobile Number +91 88860 48663</b><br/><br/><b>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b>";
                            //strBody = strBody + "<br/><b>IT Supervisor on extension 6251 (or) +91 40 6603 6251</b><br/><b>IT Manager on extension 6250   (or) +91 40 6603 6250 </b>";
                            //    //<br/><br/><b>Name of Contact</b><br/><br/><b>Manoj Kumar</b><br/><b>Shashikanth. J</b><br/><b>Vivekanand Kaatpally</b><br/><br/><b>All the above engineers are available in the above extension number only except</b>";
                            ////strBody = strBody + "<br/><br/><b>Dasani Malla Reddy</b><br/><br/><b>Extension 6253 </b><br/><b>Direct Number +91 40 6603 6253 </b><br/><br/><b>Mobile Number + 91  88860 48663</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Hyderabad IT Support </b>";
                            //strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Hyderabad IT Support </b>";
                            strBody = strBody + "<br/><br/> For any other support kindly get in touch with the <br/><br/>IT Support team &nbsp&nbsp&nbsp&nbsp on Extension 6252,Direct Number +91 40 6603 6252,Mobile Number + 91  88860 48662<br/><br/>Telephone Support staff &nbsp&nbsp&nbsp&nbsp on  Extension 6253, Direct Number +91 40 6603 6253, Mobile Number +91 88860 48663<br/><br/>If your queries are unresolved, please call us at the following extension / mobile numbers:";
                            strBody = strBody + "<br/><br/>IT Supervisor &nbsp&nbsp&nbsp&nbsp&nbsp on extension 6251 (or) +91 40 6603 6251<br/>IT Manager &nbsp&nbsp&nbsp&nbsp on extension 6250   (or) +91 40 6603 6250 ";
                            strBody = strBody + "<br/><br/>Yours sincerely,<br/><br/>  Trident Hyderabad IT Support ";

                        }
                        else if (objIncident.Siteid == 7)
                        {
                            //strBody = strBody + "<br/><br/>For any other support kindly get in touch with us at 9811801977.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";
                            strBody = strBody + "<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181  or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";
                        }
                        else if (objIncident.Siteid == 8)
                        {
                            strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at Extn:8271 or at +919962218422/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Satheesh Kumar.S,</b><br/><b>Extn: 8270</b><br/><b>Mobile: +919884398638</b><br/><b>Email: [email protected]</b>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Chennai IT Support, Ext. 8271 </b>";
                        }
                        else if (objIncident.Siteid == 9)
                        {
                            strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at +911123890505, Extn:2370 or at +911123906180/81<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Pawan Suman & Contact Details +91 7838651733 with email address [email protected]</b>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b>  Maidens Hotel IT Support, Ext, 2370 </b>";
                        }
                        else
                        {
                            strBody = strBody + "<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181  or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>";
                            strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";
                            //strBody = strBody + "<br/><br/>For any other support kindly get in touch with us at 9811801977.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";

                        }
                    LogMessage("Before mail send(Call Open)");
                    obj.Body = strBody;
                    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.ToInt32(objIncident.Incidentid);
                    string varServerName1;
                    string varfeedbackmode="0";
                    varServerName1 = Resources.MessageResource.serverNameForChangePage.ToString();
                    //added by lalit to check feedback mode. feedback should add in mail or not.
                    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;
                        /////////////////////////////////////////added on 04July13 02:18PM
                        #region Define Regards and ContactNo for differenct Sites
                        string Regards = "";
                        string Contactno = "";
                        if (objIncident.Siteid == 1) { Regards = "EIH Central Helpdesk"; Contactno = "+911123890505, Extn:2180 / 2181"; }
                        if (objIncident.Siteid == 2) { Regards = "Trident NarimanPoint IT Support Desk, Ext. 6587"; Contactno = "+912266326582 and 6587 or +91 9820831745 (24/7)"; }
                        if (objIncident.Siteid == 3) { Regards = "Trident BandraKurla IT Support, Ext. 7411 / 7412"; Contactno = "+919930455789 and Extn:7411 / 7412, +917875551291 or at +912266727411/12"; }
                        if (objIncident.Siteid == 4) { Regards = "The Oberoi Bangalore IT Support, Ext. 8546 / 8517 "; Contactno = "+918041358518, Extn:8516 / 8517"; }
                        if (objIncident.Siteid == 5) { Regards = "The Oberoi Grand Kolkata IT Support"; Contactno = "+91 33 2249 2323 2323 or at +919831519900"; }
                        if (objIncident.Siteid == 6) { Regards = "Trident Hyderabad IT Support"; Contactno = "+91 40 6603 6252 and 6252 or + 91  88860 48662"; }
                        if (objIncident.Siteid == 7) { Regards = "EIH Central Helpdesk"; Contactno = "9811801977"; }
                        if (objIncident.Siteid == 8) { Regards = "Trident Chennai IT Support, Ext. 8271"; Contactno = "Extn:8271 or at +919962218422"; }
                        if (objIncident.Siteid == 9) { Regards = "Maidens Hotel IT Support, Ext, 2370"; Contactno = "+911123890505, Extn:2370 or at +911123906180/81"; }
                        #endregion

                        ///////////////////////////////////////////end

                        obj.Subject = "Call Closed Ticket id : " + incidentid;
                        LogMessage("Call Closed TicketId" + 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;
                            if (objIncident.Siteid == 1)
                            {
                                obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181  or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>
                                <br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";
                            }
                            else if (objIncident.Siteid == 2)
                            {
                                obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +912266326582 and 6587 or +91 9820831745 (24/7)<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Name & Contact Details</b><br/><br/><b>Maruti Aldar : 6587</b><br/><b>Ranjana Kamle : 6587</b><br/><b>Brijesh Singh: 6587</b><br/>
                                   <br/><br/><b>Yours sincerely,</b><br/><br/> <b>  Trident NarimanPoint IT Support Desk, Ext. 6587 </b>";
                            }
                            else  if (objIncident.Siteid == 3)
                            {
                                obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at +919930455789 and Extn:7411 / 7412, +917875551291 or at +912266727411/12<br/><br/> <b>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/>Tier 1:  Darshan Trivedi – (+91 9819404011)</b><br/><b>Tier 2: Sudhir Nate (+91 9930455714), Jignesh Patel (+91 9987228227)</b><br/><b>Tier 3: Apurv Sharma (+91 9930455781)</b>
                                <br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident BandraKurla IT Support, Ext. 7411 / 7412 </b>";
                            }
                            else if (objIncident.Siteid == 4)
                            {
                                obj.Body = obj.Body + @"<br/><br/> <b>For any other support kindly get in touch with us at +918041358518, Extn:8516 / 8517 or email at [email protected]<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Chethan Kumar. J</b><br/><b>[email protected]</b><br/><b>System Administrator</b>
                                <br/><b>91-9916033777</b><br/><br/><b>Yunus Khatib</b><br/><b>[email protected]</b><br/><b>Systems Manager</b><br/><b>91-9886058585</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Bangalore IT Support, Ext. 8546 / 8517 </b>";
                            }
                            else if (objIncident.Siteid == 5)
                            {
                                obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at +91 33 2249 2323 2323 or at +919831519900/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Arindam Banerjee </b><br/><b>Systems Manager</b><br/><b>The Oberoi Grand</b>
                                <br/><b>Email: [email protected]</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Grand Kolkata IT Support </b>";
                            }
                            else if (objIncident.Siteid == 6)
                            {
                                // obj.Body = obj.Body + @"<br/><br/> <b>For any other support kindly get in touch with the IT Support team on  <br/><br/>Extension 6252  </b><br/><br/><b>Direct Number +91 40 6603 6252 </b><br/><b>Mobile Number + 91  88860 48662</b><br/><br/><b>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b>
                                // <br/><b>IT Supervisor on extension 6251 (or) +91 40 6603 6251</b><br/><b>IT Manager on extension 6250   (or) +91 40 6603 6250 </b><br/><br/><b>Name of Contact</b> <br/><br/><b>Manoj Kumar</b><br/><b>Shashikanth. J</b><br/><b>Vivekanand Kaatpally</b><br/><br/><b>All the above engineers are available in the above extension number only except</b>
                                // <br/><br/><b>Dasani Malla Reddy</b><br/><br/><b>Extension 6253 </b><br/><b>Direct Number +91 40 6603 6253 </b><br/><br/><b>Mobile Number + 91  88860 48663</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Hyderabad IT Support </b>";
                                obj.Body = obj.Body + @"<br/><br/> For any other support kindly get in touch with the <br/><br/>IT Support team &nbsp&nbsp&nbsp&nbsp on Extension 6252,Direct Number +91 40 6603 6252,Mobile Number + 91  88860 48662<br/><br/>Telephone Support staff &nbsp&nbsp&nbsp&nbsp on  Extension 6253, Direct Number +91 40 6603 6253, Mobile Number +91 88860 48663<br/><br/>If your queries are unresolved, please call us at the following extension / mobile numbers:
                                <br/><br/>IT Supervisor &nbsp&nbsp&nbsp&nbsp&nbsp on extension 6251 (or) +91 40 6603 6251<br/>IT Manager &nbsp&nbsp&nbsp&nbsp on extension 6250   (or) +91 40 6603 6250
                                <br/><br/>Yours sincerely,<br/><br/>  Trident Hyderabad IT Support ";
                            }
                            else if (objIncident.Siteid == 7)
                            {
                                obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181  or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>
                                <br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";
                            }
                            else if (objIncident.Siteid == 8)
                            {
                                obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at Extn:8271 or at +919962218422/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Satheesh Kumar.S,</b><br/><b>Extn: 8270</b><br/><b>Mobile: +919884398638</b><br/><b>Email: [email protected]</b>
                                <br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Chennai IT Support, Ext. 8271 </b>";
                            }
                            else if (objIncident.Siteid == 9)
                            {
                                obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at +911123890505, Extn:2370 or at +911123906180/81<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>Pawan Suman & Contact Details +91 7838651733 with email address [email protected]</b>
                              <br/><br/><b>Yours sincerely,</b><br/><br/> <b>  Maidens Hotel IT Support, Ext, 2370 </b>";
                            }
                             else
                             {
                                 obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181  or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory  kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>
                                <br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>";
                             }
                                //+ "<br/><br/> For any other support, kindly get in touch with us at "
                                //+ Contactno + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b>"
                                //+ Regards + "</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 "
                                + Contactno + ".<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>"
                                + Regards + "</b>";
                        }
                        LogMessage("Before mail send(Call Closed)");
                        obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
                        obj.SentMail();
                    }
                }
            }
            //int id = Convert.ToInt32(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();
           //}
        }
    }
    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 ShowResolution()
    {
        IncidentResolution objIncidentResolution = new IncidentResolution();
        #region Declaration of Dynamic Table,and Placeholder
        PlaceHolderResolution.Controls.Clear();
        Table tbl = new Table();
        PlaceHolderResolution.Controls.Add(tbl);
        int hdwidth = 1500;
        int height = 5;
        #endregion

        int incidentid = Convert.ToInt32(Session["incidentid"].ToString());

        #region Get Collection of Log From IncidentLog table via incidentid
        colIncidentResolution = objIncidentResolution.Get_All_By_incidentid(incidentid);
        if (colIncidentResolution.Count == 0)
        {

            TableRow tabRow3 = new TableRow();
            TableCell tbCell3 = new TableCell();
            tbCell3.Width = hdwidth;
            tbCell3.Height = height;
            Label lbl3 = new Label();
            lbl3.Text = "No Record Found";
            lbl3.Font.Size = FontUnit.Smaller;
            tbCell3.Controls.Add(lbl3);
            tabRow3.Cells.Add(tbCell3);
            tbl.Rows.Add(tabRow3);

        }
        foreach (IncidentResolution obj in colIncidentResolution)
        {

            #region Fetch Username on the basis of Operationownerid,by calling Get_By_id() function of Userlogin_mst Instance
            string username;
            objUser = objUser.Get_By_id(obj.Userid);
            username = objUser.Username.ToString();
            #endregion
            #region Declaration of Tablerow,TableCell and lable object
            TableRow tabRow = new TableRow();
            TableCell tbCell = new TableCell();
            tbCell.Width = hdwidth;
            Label lbl = new Label();
            #endregion
            #region Print Each Operation Performed by User
            lbl.Font.Bold = true;
            lbl.Text = "&nbsp;&nbsp;" + username + "&nbsp;&nbsp;&nbsp;&nbsp;said on&nbsp;&nbsp;&nbsp;&nbsp;" + obj.Lastupdatetime.ToString();
            #endregion
            #region Fix background color of Row

            tabRow.BackColor = System.Drawing.Color.Lavender;

            #endregion
            #region Add label,cell,and Row to tabel
            tbCell.Controls.Add(lbl);
            tabRow.Cells.Add(tbCell);
            tbl.Rows.Add(tabRow);
            #endregion

            #region Declaration of local variables,tablerow,tablecell and label
            TableRow tabRowInner = new TableRow();
            TableCell tbCellInner = new TableCell();
            tbCellInner.Width = hdwidth;
            Label lblinner = new Label();
            lblinner.Font.Size = FontUnit.Smaller;
            #endregion

            #region Print Each Operation Performed by User
            lblinner.Font.Bold = true;
            lblinner.Text = "&nbsp;&nbsp;&nbsp;&nbsp;" + obj.Resolution.ToString();
            #endregion

            #region Label,cells and rows to Tabel of inner loop
            tabRowInner.BackColor = System.Drawing.Color.White;
            tbCellInner.Controls.Add(lblinner);
            tabRowInner.Cells.Add(tbCellInner);
            tbl.Rows.Add(tabRowInner);
            #endregion

        }

        #endregion
    }
コード例 #27
0
        private void CloseIncident(EntityReference caseReference)
        {
            //<snippetCloseIncident>
            // First close the Incident

            // Create resolution for the closing incident
            IncidentResolution resolution = new IncidentResolution
            {
                Subject = "Case Closed",
            };

            resolution.IncidentId = caseReference;

            // Create the request to close the incident, and set its resolution to the 
            // resolution created above
            CloseIncidentRequest closeRequest = new CloseIncidentRequest();
            closeRequest.IncidentResolution = resolution;

            // Set the requested new status for the closed Incident
            closeRequest.Status = 
                new OptionSetValue((int)incident_statuscode.ProblemSolved);

            // Execute the close request
            CloseIncidentResponse closeResponse = 
                (CloseIncidentResponse)_serviceProxy.Execute(closeRequest);

            //Check if the incident was successfully closed
            Incident incident = _serviceProxy.Retrieve(Incident.EntityLogicalName, 
                _caseIncidentId, new ColumnSet(allColumns: true)).ToEntity<Incident>();

            if (incident.StateCode.HasValue && 
                incident.StateCode == IncidentState.Resolved)
            {
                Console.WriteLine("The incident was closed out as Resolved.");
            }
            else
            {
                Console.WriteLine("The incident's state was not changed.");
            }
            //</snippetCloseIncident>  
        }
    public CollectionBase GenerateIncidentResolution_mstCollection(ref IDataReader returnData)
    {
        BLLCollection<IncidentResolution> col = new BLLCollection<IncidentResolution>();
        while (returnData.Read())
        {

            IncidentResolution obj = new IncidentResolution();
            obj.Incidentid = (int)returnData["Incidentid"];
            obj.Userid = (int)returnData["Userid"];
            obj.Resolution = (string)returnData["Resolution"];
            if (returnData["Lastupdatetime"] != DBNull.Value)
            {
                DateTime Mydatetime = new DateTime();
                Mydatetime = (DateTime)returnData["Lastupdatetime"];
                obj.Lastupdatetime = Mydatetime.ToString();
            }

            col.Add(obj);
        }
        returnData.Close();
        returnData.Dispose();
        return col;
    }
    public object GenerateIncidentResolution_mstObject(ref IDataReader returnData)
    {
        IncidentResolution obj = new IncidentResolution();
        while (returnData.Read())
        {
            obj.Incidentid = (int)returnData["Incidentid"];
            obj.Userid = (int)returnData["Userid"];
            obj.Resolution = (string)returnData["Resolution"];
            if (returnData["Lastupdatetime"] != DBNull.Value)
            {
                DateTime Mydatetime = new DateTime();
                Mydatetime = (DateTime)returnData["Lastupdatetime"];
                obj.Lastupdatetime = Mydatetime.ToString();
            }

        }
        returnData.Close();
        returnData.Dispose();
        return obj;
    }
 public int Insert_IncidentResolution(IncidentResolution objIncidentResolution)
 {
     return (int)ExecuteNonQuery(Sp_IncidentResolution_Insert, new object[] { objIncidentResolution.Resolution, objIncidentResolution.Lastupdatetime, objIncidentResolution.Incidentid, objIncidentResolution.Userid });
 }
コード例 #31
0
ファイル: CloseAnIncident.cs プロジェクト: cesugden/Scripts
        private void RunIncidentManipulation()
        {
            Console.WriteLine("=== Creating and Closing an Incident (Case) ===");

            // Create an incident.
            var incident = new Incident
            {
                CustomerId = new EntityReference(Account.EntityLogicalName, _accountId),
                Title = "Sample Incident"
            };

            _incidentId = _serviceProxy.Create(incident);
            NotifyEntityCreated(Incident.EntityLogicalName, _incidentId);

	        // Create a 30-minute appointment regarding the incident.
            var appointment = new Appointment
            {
                ScheduledStart = DateTime.Now,
                ScheduledEnd = DateTime.Now.Add(new TimeSpan(0, 30, 0)),
                Subject = "Sample 30-minute Appointment",
                RegardingObjectId = new EntityReference(Incident.EntityLogicalName,
                    _incidentId)
            };

            _appointmentId = _serviceProxy.Create(appointment);
            NotifyEntityCreated(Appointment.EntityLogicalName, _appointmentId);

		    // Show the time spent on the incident before closing the appointment.
            NotifyTimeSpentOnIncident();
		    // Check the validity of the state transition to closed on the incident.
            NotifyValidityOfIncidentSolvedStateChange();
            //<snippetCloseAnIncident1>
            // Close the appointment.
            var setAppointmentStateReq = new SetStateRequest
            {
                EntityMoniker = new EntityReference(Appointment.EntityLogicalName,
                    _appointmentId),
                State = new OptionSetValue((int)AppointmentState.Completed),
                Status = new OptionSetValue((int)appointment_statuscode.Completed)
            };

            _serviceProxy.Execute(setAppointmentStateReq);

            Console.WriteLine("  Appointment state set to completed.");
            //</snippetCloseAnIncident1>

            // Show the time spent on the incident after closing the appointment.
            NotifyTimeSpentOnIncident();
		    // Check the validity of the state transition to closed again.
            NotifyValidityOfIncidentSolvedStateChange();
		
	        // Create the incident's resolution.
            var incidentResolution = new IncidentResolution
            {
                Subject = "Resolved Sample Incident",
                IncidentId = new EntityReference(Incident.EntityLogicalName, _incidentId)
            };

            //<snippetCloseAnIncident2>
            // Close the incident with the resolution.
            var closeIncidentRequest = new CloseIncidentRequest
            {
                IncidentResolution = incidentResolution,
                Status = new OptionSetValue((int)incident_statuscode.ProblemSolved)
            };

            _serviceProxy.Execute(closeIncidentRequest);

            Console.WriteLine("  Incident closed.");
            //</snippetCloseAnIncident2>
        }
    protected void btnResolution_Click(object sender, EventArgs e)
    {
        int userid = 0;
        string userName;
        MembershipUser User = Membership.GetUser();
        userName = User.UserName.ToString();

        if (userName != "")
        {

            objOrganization = objOrganization.Get_Organization();
            objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid);
            if (objUser.Userid != 0)
            {
                userid = objUser.Userid;
            }
        }
        IncidentResolution objIncidentResolution = new IncidentResolution();
        #region Get incidentid from QueryString
        int incidentid = Convert.ToInt16(Request.QueryString[0]);
        #endregion
        #region Check Is Resolution Exist in Database
        objIncidentResolution = objIncidentResolution.Get_By_id(incidentid);
        #endregion
        #region Add Resolution  in Database

        string varResolution;
        varResolution = Editor.Text;
        objIncidentResolution.Incidentid = incidentid;
        objIncidentResolution.Lastupdatetime = DateTime.Now.ToString();
        objIncidentResolution.Resolution = varResolution;
        objIncidentResolution.Userid = userid;
        objIncidentResolution.Insert();
        Editor.Text = "";
        ShowResolution();

        #endregion
    }
 public int Update_IncidentResolution_By_id(IncidentResolution objIncidentResolution)
 {
     return (int)ExecuteNonQuery(Sp_IncidentResolution_Update, new object[] { objIncidentResolution.Resolution, objIncidentResolution.Lastupdatetime, objIncidentResolution.Incidentid });
 }