コード例 #1
0
    public static string deleteTicket(string tid)
    {
        TicketSystem tsystem = new TicketSystem();
        int          i       = tsystem.DeleteTicket(tid);

        return(i > 0 ? "y" : "n");
    }
コード例 #2
0
 public void Run()
 {
     TicketSystem.PrintOptions();
     while (_running)
     {
         PrintMessages();
         GetUserInput();
     }
     Console.Clear();
     Console.WriteLine("Goodbye");
 }
コード例 #3
0
 public string StartETicketingSystem(TicketSystem TicketSystem, string Template, string userId)
 {
     try
     {
         ProcessFlowBC ProcessFlowBC = new ProcessFlowBC();
         return(ProcessFlowBC.StartETicketingSystem(TicketSystem, Template, userId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally { }
 }
コード例 #4
0
 public string SaveOrUpdateTicketSystem(TicketSystem TicketSystem)
 {
     try
     {
         TicketSystemBC TicketSystemBC = new TicketSystemBC();
         return(TicketSystemBC.SaveOrUpdateTicketSystem(TicketSystem));
     }
     catch (Exception)
     {
         throw;
     }
     finally { }
 }
コード例 #5
0
 public string StartETicketingSystem(TicketSystem TicketSystem, string Template, string userId)
 {
     try
     {
         WorkFlowTemplate WorkFlowTemplate = PSF.Get <WorkFlowTemplate>("TemplateName", Template);
         //creating process instance
         ProcessInstance pi = new ProcessInstance();
         pi.CreatedBy   = userId;
         pi.DateCreated = DateTime.Now;
         pi.TemplateId  = WorkFlowTemplate.Id;
         pi.Status      = "Activated";
         PSF.SaveOrUpdate <ProcessInstance>(pi);
         long pid = pi.Id;
         //create object with the pid for FFExport
         TicketSystem.InstanceId = pid;
         PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
         string ticketNo = "ETicket-" + TicketSystem.Id;
         TicketSystem.TicketNo = ticketNo;
         PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
         IList <WorkFlowStatus> WorkFlowStatusList = PSF.GetList <WorkFlowStatus>("TemplateId", WorkFlowTemplate.Id, "ActivityOrder", 1);
         foreach (WorkFlowStatus wfs in WorkFlowStatusList)
         {
             Activity NextActivity = new Activity();
             NextActivity.ActivityName     = wfs.WFStatus;
             NextActivity.ActivityFullName = wfs.Description;
             NextActivity.AppRole          = wfs.Performer;
             NextActivity.Completed        = false;
             NextActivity.Available        = true;
             NextActivity.Assigned         = false;
             NextActivity.Performer        = userId;
             NextActivity.TemplateId       = WorkFlowTemplate.Id;
             NextActivity.InstanceId       = pid;
             NextActivity.NextActOrder     = wfs.NextActOrder;
             NextActivity.ActivityOrder    = wfs.ActivityOrder;
             NextActivity.PreviousActOrder = 1;
             NextActivity.ProcessRefId     = TicketSystem.Id;
             NextActivity.CreatedDate      = DateTime.Now;
             NextActivity.BranchCode       = TicketSystem.BranchCode;
             NextActivity.DeptCode         = TicketSystem.DeptCode;
             if (wfs.IsRejectionRequired == true)
             {
                 NextActivity.IsRejApplicable = true;
             }
             PSF.SaveOrUpdate <Activity>(NextActivity);
         }
         return(TicketSystem.TicketNo);
     }
     catch (Exception) { throw; }
 }
コード例 #6
0
 public bool CompleteActivityTicketSystem(TicketSystem TicketSystem, string Template, string userId, string ActivityName, bool isRejection)
 {
     try
     {
         bool          retValue      = false;
         ProcessFlowBC ProcessFlowBC = new ProcessFlowBC();
         ProcessFlowBC.CompleteActivityTicketSystem(TicketSystem, Template, userId, ActivityName, isRejection);
         retValue = true;
         return(retValue);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally { }
 }
コード例 #7
0
    public static string updateticket(string id, string sub, string tat, string qry, string status, string priority, string attachfile)
    {
        TicketSystem tsystem = new TicketSystem();
        Ticket       tc      = new Ticket();

        tc.Id             = Convert.ToInt64(id.Trim());
        tc.Subject        = sub.Trim();
        tc.Tat            = tat.Trim();
        tc.Query          = qry.Trim();
        tc.Attachment     = attachfile;
        tc.UpdatedByEmail = HttpContext.Current.Session["AdminSessionID"].ToString();
        tc.Status         = Convert.ToInt32(status.Trim());
        tc.Priority       = Convert.ToInt32(priority.Trim());
        int i = tsystem.UpdateTicket(tc);

        return(i > 0 ? "y" : "n");
    }
コード例 #8
0
    public static string addticket(string qry, string depid, string roleid, string assigntoemail, string reporttoemail, string status, string priority, string attachfile)
    {
        TicketSystem tsystem = new TicketSystem();
        Ticket       tc      = new Ticket();

        tc.Query          = qry.Trim();
        tc.Attachment     = attachfile;
        tc.DepId          = depid.Trim();
        tc.RoleId         = roleid.Trim();
        tc.CreatorEmail   = HttpContext.Current.Session["AdminSessionID"].ToString();
        tc.AssignerRoleId = HttpContext.Current.Session["roleid"].ToString();
        tc.AssignToEmail  = assigntoemail.Trim();
        tc.ReportToEmail  = reporttoemail.Trim();
        tc.Status         = Convert.ToInt32(status.Trim());
        tc.Priority       = Convert.ToInt32(priority.Trim());
        int i = tsystem.CreateTicket(tc);

        return(i > 0?"y":"n");
    }
コード例 #9
0
        public bool UpdateTicketStatus(long TicketId, string TicketStatus)
        {
            try
            {
                if (TicketId > 0)
                {
                    TicketSystem TicketSystem = PSF.Get <TicketSystem>(TicketId);
                    TicketSystem.TicketStatus = TicketStatus;
                    PSF.Update <TicketSystem>(TicketSystem);
                    return(true);
                }

                else
                {
                    return(false);
                }
            }
            catch (Exception)
            { throw; }
        }
コード例 #10
0
        public void Run()
        {
            ticketSystem = new TicketSystem();
            active       = true;
            Console.Clear();
            Console.WriteLine(@"
___________.__        __           __ ___________                     __                 
\__    ___/|__| ____ |  | __ _____/  |\__    ___/___________    ____ |  | __ ___________ 
  |    |   |  |/ ___\|  |/ // __ \   __\|    |  \_  __ \__  \ _/ ___\|  |/ // __ \_  __ \
  |    |   |  \  \___|    <\  ___/|  |  |    |   |  | \// __ \\  \___|    <\  ___/|  | \/
  |____|   |__|\___  >__|_ \\___  >__|  |____|   |__|  (____  /\___  >__|_ \\___  >__|   
                   \/     \/    \/                          \/     \/     \/    \/       
            ");
            ticketSystem.PrintAll();
            while (active)
            {
                System.Console.WriteLine("What would you like to do? (view / new / quit)");
                string choice = Console.ReadLine();
                GetUserInput(choice);
            }
        }
コード例 #11
0
 public string SaveOrUpdateTicketSystem(TicketSystem TicketSystem)
 {
     try
     {
         if (TicketSystem.Id > 0)
         {
             PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
         }
         else
         {
             string ticketNo = "ETicket-" + TicketSystem.Id;
             TicketSystem.TicketNo = ticketNo;
             PSF.Save <TicketSystem>(TicketSystem);
         }
         return(TicketSystem.TicketNo);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #12
0
        public void SendEmailNotification(TicketSystem objTcktSys, string userid, string activityName, bool?isrejction, string MailBody)
        {
            try
            {
                // IList<CampusEmailId> campusemaildet = GetEmailIdByCampus(objTcktSys.BranchCode, ConfigurationManager.AppSettings["CampusEmailType"].ToString());
                bool        rejection = isrejction ?? true;// false;
                UserService us        = new UserService();
                Dictionary <long, IList <UserAppRole> > userAppRole         = new Dictionary <long, IList <UserAppRole> >();
                Dictionary <string, object>             criteriaUserAppRole = new Dictionary <string, object>();

                //Based on activity need to assign the role to get the users
                //logic need to be written
                criteriaUserAppRole.Add("IsActive", true);
                //criteriaUserAppRole.Add("AppCode", "TKT");
                //if (activityName == "LogETicket" || activityName == "ResolveETicketRejection" || activityName == "CloseETicket")
                //{
                //    criteriaUserAppRole.Add("RoleCode", "ETR");
                //}
                //else if (activityName == "ResolveETicket" || activityName == "CloseETicketRejection")
                //{ criteriaUserAppRole.Add("RoleCode", "ETC"); }
                //else return;

                criteriaUserAppRole.Add("AppCode", new string[] { "TKT", "All" });
                if (activityName == "LogETicket" || activityName == "ResolveETicketRejection" || activityName == "CloseETicket")
                {
                    criteriaUserAppRole.Add("RoleCode", new string[] { "ETR", "All" });
                }
                else if (activityName == "ResolveETicket" || activityName == "CloseETicketRejection")
                {
                    criteriaUserAppRole.Add("RoleCode", new string[] { "ETC", "All" });
                }
                else
                {
                    return;
                }
                userAppRole = us.GetRoleUsersListWithPagingAndCriteria(0, 1000, string.Empty, string.Empty, criteriaUserAppRole);
                //if list userAppRole is null then empty grid
                if (userAppRole != null && userAppRole.Count > 0 && userAppRole.First().Key > 0)
                {
                    int count = userAppRole.First().Value.Count;
                    //if it has values then for each concatenate APP+ROLE
                    string[] userEmails = new string[count];

                    int i = 0;
                    Dictionary <string, object> criteria = new Dictionary <string, object>();

                    string[] userToEmail  = (from u in userAppRole.FirstOrDefault().Value where u.AppCode != "All" && !string.IsNullOrEmpty(u.Email) select u.Email).ToArray();
                    string[] userBccEmail = (from u in userAppRole.FirstOrDefault().Value where u.AppCode == "All" && !string.IsNullOrEmpty(u.Email) select u.Email).ToArray();

                    //foreach (UserAppRole uar in userAppRole.First().Value)
                    //{
                    //    if (!string.IsNullOrWhiteSpace(uar.Email))
                    //    {
                    //        userEmails[i] = uar.Email.Trim();
                    //    }
                    //    i++;
                    //}
                    if (userToEmail == null || (userToEmail[0] == null && userToEmail.Length == 0))
                    {
                        return;
                    }
                    if (userToEmail != null && userToEmail.Length > 0)
                    {
                        string SendEmail = ConfigurationManager.AppSettings["SendEmailOption"];
                        string From      = ConfigurationManager.AppSettings["From"];
                        if (SendEmail == "false")
                        {
                            return;
                        }
                        else
                        {
                            try
                            {
                                System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                                mail.Subject = "e-Ticket Notification" + objTcktSys.TicketNo + " "; string msg = "";

                                foreach (string s in userToEmail)
                                {
                                    if (!string.IsNullOrWhiteSpace(s))
                                    {
                                        bool IsValid = IsValidEmail(s);
                                        if (IsValid == true)
                                        {
                                            mail.To.Add(s);
                                        }
                                    }
                                }
                                if (userBccEmail != null && userBccEmail.Length > 0)
                                {
                                    foreach (string s in userBccEmail)
                                    {
                                        if (!string.IsNullOrWhiteSpace(s))
                                        {
                                            bool IsValid = IsValidEmail(s);
                                            if (IsValid == true)
                                            {
                                                mail.Bcc.Add(s);
                                            }
                                        }
                                    }
                                }
                                switch (activityName)
                                {
                                case "LogETicket":
                                {
                                    msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Logged for the module " + objTcktSys.Module + " with " + objTcktSys.Priority + " priority. The e-Ticket is Raised by " + userid + ". Please try resolving the ticket based on Priority. The summary of the ticket is <b><i>\"" + objTcktSys.Summary + "\"</i></b> ";
                                    break;
                                }

                                case "ResolveETicket":
                                {
                                    if (rejection)
                                    {
                                        msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Rejected for the module " + objTcktSys.Module + ". The e-Ticket is Rejected for additional information by " + userid + ". Please try replying the same based on the comments.<b><i>\"" + ShowComments(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo) + "\"</i></b>";
                                        msg  = msg + CommentSummary(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo);
                                    }
                                    else
                                    {
                                        msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Resolved for the module " + objTcktSys.Module + ". The e-Ticket is Resolved by " + userid + " with comments <b><i>\"" + ShowComments(objTcktSys.Id, userid, "ResolveETicket", "Resolution", objTcktSys.TicketNo) + "\"</i></b>. Please verify the same and complete/Reject based on the results. ";
                                        msg  = msg + CommentSummary(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo);
                                    }
                                    break;
                                }

                                case "ResolveETicketRejection":
                                {
                                    msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Replied for the module " + objTcktSys.Module + ".by " + userid + " with Comments. <b><i>\"" + ShowComments(objTcktSys.Id, userid, "ResolveETicketRejection", "Resolution", objTcktSys.TicketNo) + "\"</i></b>. Please try resolving the same based on the reply comments. ";
                                    msg  = msg + CommentSummary(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo);
                                    break;
                                }

                                case "CloseETicketRejection":
                                {
                                    if (rejection)
                                    {
                                        msg += "";
                                    }
                                    else
                                    {
                                        msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Rejected for the module " + objTcktSys.Module + ". The e-Ticket is Rejected by " + userid + " <b><i>\"" + ShowComments(objTcktSys.Id, userid, "CloseETicketRejection", "Resolution", objTcktSys.TicketNo) + "\"</i></b>. Please try resolving the same based on the comments. ";
                                        msg  = msg + CommentSummary(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo);
                                    }
                                    break;
                                }

                                case "CloseETicket":
                                {
                                    if (rejection)
                                    {
                                        msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Rejected for the module " + objTcktSys.Module + ". The e-Ticket is Rejected for additionnal information by " + userid + " <b><i>\"" + ShowComments(objTcktSys.Id, userid, "CloseETicket", "Rejection", objTcktSys.TicketNo) + "\"</i></b>. Please try replying the same based on the comments. ";
                                        msg  = msg + CommentSummary(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo);
                                    }
                                    //else msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Completed for the module " + objTcktSys.Module + ". The e-Ticket is Completed by " + userid + " with comments <b><i>\"" + objTcktSys.Comments + "\"</i></b> ";
                                    else
                                    {
                                        msg += "An e-Ticket " + objTcktSys.TicketNo + " has been Completed for the module " + objTcktSys.Module + ". The e-Ticket is Completed by " + userid + " with comments <b><i>\"" + ShowComments(objTcktSys.Id, userid, "CloseETicket", "Resolution", objTcktSys.TicketNo) + "\"</i></b> ";
                                        msg  = msg + CommentSummary(objTcktSys.Id, userid, "ResolveETicket", "Rejection", objTcktSys.TicketNo);
                                    }
                                    break;
                                }

                                default:
                                    return;
                                }
                                MailBody = MailBody.Replace("{{DateTime}}", DateTime.Now.ToString());
                                MailBody = MailBody.Replace("{{Content}}", msg);
                                //Body = Body.Replace("{{footer}}", footer);
                                mail.Body       = MailBody;
                                mail.IsBodyHtml = true;
                                SmtpClient smtp = new SmtpClient("localhost", 25);
                                smtp.Host           = "smtp.gmail.com";
                                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                                smtp.EnableSsl      = true;
                                if (From == "live")
                                {
                                    try
                                    {
                                        mail.From        = new MailAddress("*****@*****.**");
                                        smtp.Credentials = new System.Net.NetworkCredential
                                                               ("*****@*****.**", "Spring@2k14");
                                        smtp.Send(mail);
                                    }
                                    catch (Exception ex)
                                    {
                                        #region saveorupdate Errorlog
                                        OrdersService OrdSer = new OrdersService();
                                        ErrorLog      err    = new ErrorLog();
                                        err.Controller  = "EmailHelper";
                                        err.Action      = "SendEmailNotification";
                                        err.Err_Desc    = ex.ToString();
                                        err.CreatedDate = DateTime.Now;
                                        OrdSer.SaveOrUpdateErrorLog(err);
                                        #endregion

                                        if (ex.Message.Contains("quota"))
                                        {
                                            mail.From        = new MailAddress("*****@*****.**");
                                            smtp.Credentials = new System.Net.NetworkCredential
                                                                   ("*****@*****.**", "Ginger@27");
                                            smtp.Send(mail);
                                        }
                                        else
                                        {
                                            mail.From        = new MailAddress("*****@*****.**");
                                            smtp.Credentials = new System.Net.NetworkCredential
                                                                   ("*****@*****.**", "JohnSGrasiasXcd");
                                            smtp.Send(mail);
                                        }
                                    }
                                }
                                else if (From == "test")
                                {
                                    mail.From        = new MailAddress("*****@*****.**");
                                    smtp.Credentials = new System.Net.NetworkCredential
                                                           ("*****@*****.**", "Spring@2k14");
                                    //this is to send email to test mail only to avoid mis communication to the parent
                                    //  mail.To.Add("*****@*****.**");
                                    smtp.Send(mail);
                                }
                                EmailLog el = new EmailLog();
                                el.Id = 0;

                                el.EmailTo = mail.To.ToString();

                                el.EmailCC = mail.CC.ToString();
                                if (mail.Bcc.ToString().Length < 3990)
                                {
                                    el.EmailBCC = mail.Bcc.ToString();
                                }

                                el.Subject = mail.Subject.ToString();

                                if (mail.Body.ToString().Length < 3990)
                                {
                                    el.Message = msg;
                                }
                                el.EmailDateTime = DateTime.Now;
                                el.BCC_Count     = mail.Bcc.Count;
                                el.Module        = "ETicket";
                                //create the admission management object
                                MastersService msObj = new MastersService();
                                //log the email to the database
                                msObj.CreateOrUpdateEmailLog(el);
                            }
                            catch (Exception ex)
                            {
                                #region saveorupdate Errorlog
                                OrdersService OrdSer = new OrdersService();
                                ErrorLog      err    = new ErrorLog();
                                err.Controller  = "EmailHelper";
                                err.Action      = "SendEmailNotification";
                                err.Err_Desc    = ex.ToString();
                                err.CreatedDate = DateTime.Now;
                                OrdSer.SaveOrUpdateErrorLog(err);
                                #endregion

                                throw ex;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                #region saveorupdate Errorlog
                OrdersService OrdSer = new OrdersService();
                ErrorLog      err    = new ErrorLog();
                err.Controller  = "EmailHelper";
                err.Action      = "SendEmailNotification";
                err.Err_Desc    = ex.ToString();
                err.CreatedDate = DateTime.Now;
                OrdSer.SaveOrUpdateErrorLog(err);
                #endregion
                ExceptionPolicy.HandleException(ex, "TicketingSystem");
                throw ex;
            }
        }
コード例 #13
0
    public static List <Employee> GetReportTo(string depid, string assignuserid)
    {
        TicketSystem tsystem = new TicketSystem();

        return(tsystem.ReportingRoleList(depid, HttpContext.Current.Session["roleid"].ToString(), HttpContext.Current.Session["AdminSessionID"].ToString(), assignuserid));
    }
コード例 #14
0
    public static List <Employee> GetAssignTo(string roleid)
    {
        TicketSystem tsystem = new TicketSystem();

        return(tsystem.EmployeeList(roleid, HttpContext.Current.Session["AdminSessionID"].ToString()));
    }
コード例 #15
0
    public static List <Role> GetRoles(string depid)
    {
        TicketSystem tsystem = new TicketSystem();

        return(tsystem.RoleList(depid, HttpContext.Current.Session["roleid"].ToString()));
    }
コード例 #16
0
    public static List <Department> GetDepartments()
    {
        TicketSystem tsystem = new TicketSystem();

        return(tsystem.DepartmentList());
    }
コード例 #17
0
        public bool CompleteActivityTicketSystem(TicketSystem TicketSystem, string Template, string userId, string ActivityName, bool isRejection)
        {
            bool retValue = false;

            try
            {
                PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
                WorkFlowTemplate WorkFlowTemplate = PSF.Get <WorkFlowTemplate>("TemplateName", Template);
                //close the current activity
                Activity CurrentActivity = PSF.Get <Activity>("InstanceId", TicketSystem.InstanceId, "ActivityName", ActivityName, "Completed", false);
                if (CurrentActivity != null)
                {
                    //if current activity doesnt need any rejection and there is no rejection then it will be completed
                    //otherwise once the rejection resolved then it will be completed
                    //this need to be obdated as waiting
                    if (CurrentActivity.IsRejApplicable == true && isRejection == true)
                    {
                        CurrentActivity.BranchCode = TicketSystem.BranchCode;
                        CurrentActivity.DeptCode   = TicketSystem.DeptCode;
                        CurrentActivity.Completed  = true;
                        CurrentActivity.Available  = false;
                        CurrentActivity.Assigned   = false;
                        CurrentActivity.Performer  = userId;
                        PSF.SaveOrUpdate(CurrentActivity);
                    }
                    else
                    {
                        Activity WaitingAct = PSF.Get <Activity>("WaitingFor", CurrentActivity.Id);
                        if (WaitingAct != null)
                        {
                            CurrentActivity.BranchCode = TicketSystem.BranchCode;
                            CurrentActivity.DeptCode   = TicketSystem.DeptCode;
                            CurrentActivity.Waiting    = false;
                            PSF.SaveOrUpdate(CurrentActivity);
                            WaitingAct.Completed = true;
                            WaitingAct.Assigned  = false;
                            WaitingAct.Available = false;
                        }
                        CurrentActivity.BranchCode = TicketSystem.BranchCode;
                        CurrentActivity.DeptCode   = TicketSystem.DeptCode;
                        CurrentActivity.Completed  = true;
                        CurrentActivity.Available  = false;
                        CurrentActivity.Assigned   = false;
                        CurrentActivity.Performer  = userId;
                        if (CurrentActivity.ActivityName == "CompleteETicket")
                        {
                            TicketSystem.IsTicketCompleted = true;
                            PSF.Update <TicketSystem>(TicketSystem);
                            ProcessInstance pi = PSF.Get <ProcessInstance>(TicketSystem.InstanceId);
                            pi.Status           = "Completed"; PSF.SaveOrUpdate <ProcessInstance>(pi);
                            TicketSystem.Status = "Completed";
                            PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
                        }
                        PSF.SaveOrUpdate(CurrentActivity);
                    }
                }
                //trigger the next activity //we need to check whether parallel activities are there to complete
                //activities that are coming in the next order
                IList <WorkFlowStatus> WorkFlowStatusList = PSF.GetList <WorkFlowStatus>("TemplateId", WorkFlowTemplate.Id, "ActivityOrder", CurrentActivity.NextActOrder);
                //checking parallel activities get the current order of activities
                Dictionary <string, object> WaitCriteria = new Dictionary <string, object>();
                WaitCriteria.Add("TemplateId", WorkFlowTemplate.Id);
                WaitCriteria.Add("ActivityOrder", CurrentActivity.ActivityOrder);
                WaitCriteria.Add("InstanceId", CurrentActivity.InstanceId);
                Dictionary <long, IList <Activity> > conditionList = PSF.GetListWithSearchCriteriaCount <Activity>(0, 100, string.Empty, string.Empty, WaitCriteria);
                if (conditionList != null && conditionList.Count > 0)
                {
                    IList <Activity> conditionWaitList = conditionList.First().Value;
                    bool?            waiting           = false;
                    foreach (Activity a in conditionWaitList)
                    {
                        if (a.Completed == false && waiting == false)
                        {
                            waiting = true;
                        }
                    }
                    retValue = true;
                    if (waiting == true)
                    {
                        if (CurrentActivity.IsRejApplicable == true && isRejection == true)
                        {
                        }
                        else
                        {
                            return(retValue);
                        }
                    }
                }
                if (WorkFlowStatusList != null && WorkFlowStatusList.Count > 0)
                {
                    //if it is rejection flow then build the logic here
                    //{logic goes here }


                    foreach (WorkFlowStatus wfs in WorkFlowStatusList)
                    {
                        //Rejection Activity
                        if (CurrentActivity.IsRejApplicable == true && isRejection == true)
                        {
                            WorkFlowStatus wfsRej = PSF.Get <WorkFlowStatus>("TemplateId", WorkFlowTemplate.Id, "RejectionFor", CurrentActivity.ActivityOrder);
                            if (wfsRej != null)
                            {
                                Activity NextActivityRej = new Activity();
                                NextActivityRej.CreatedDate  = DateTime.Now;
                                NextActivityRej.ActivityName = wfsRej.WFStatus;
                                if (NextActivityRej.ActivityName == "CompleteETicket")
                                {
                                    NextActivityRej.Completed = true;
                                    //ProcessInstance pi = PSF.Get<ProcessInstance>(CallManagement.InstanceId);
                                    //pi.Status = "Completed"; PSF.SaveOrUpdate<ProcessInstance>(pi);
                                    TicketSystem.Status = NextActivityRej.ActivityName;
                                    PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
                                }
                                else
                                {
                                    NextActivityRej.Completed = false;
                                }
                                NextActivityRej.ActivityFullName = wfsRej.Description;
                                NextActivityRej.AppRole          = wfsRej.Performer;

                                NextActivityRej.Performer        = userId;
                                NextActivityRej.TemplateId       = WorkFlowTemplate.Id;
                                NextActivityRej.InstanceId       = TicketSystem.InstanceId;
                                NextActivityRej.NextActOrder     = wfsRej.NextActOrder;
                                NextActivityRej.ActivityOrder    = wfsRej.ActivityOrder;
                                NextActivityRej.PreviousActOrder = wfsRej.PreviousActOrder;
                                NextActivityRej.ProcessRefId     = TicketSystem.Id;
                                NextActivityRej.RejectionFor     = CurrentActivity.Id;
                                NextActivityRej.Completed        = false;
                                NextActivityRej.Available        = true;
                                NextActivityRej.Assigned         = false;
                                NextActivityRej.BranchCode       = TicketSystem.BranchCode;
                                NextActivityRej.DeptCode         = TicketSystem.DeptCode;
                                PSF.SaveOrUpdate <Activity>(NextActivityRej);
                                TicketSystem.Status = NextActivityRej.ActivityName;
                                PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
                                //CurrentActivity.WaitingFor = NextActivityRej.Id;
                                //PSF.SaveOrUpdate(CurrentActivity);
                            }
                        }
                        else
                        {
                            Activity NextActivity = new Activity();
                            NextActivity.CreatedDate = DateTime.Now;
                            if (wfs.IsRejectionRequired == true)
                            {
                                NextActivity.IsRejApplicable = true;
                            }

                            NextActivity.ActivityName     = wfs.WFStatus;
                            NextActivity.ActivityFullName = wfs.Description;
                            NextActivity.AppRole          = wfs.Performer;
                            NextActivity.Completed        = wfs.WFStatus == "Complete" ? true : false;
                            NextActivity.Available        = wfs.WFStatus != "Complete" ? true : false;
                            //NextActivity.Performer = userId;
                            NextActivity.TemplateId       = WorkFlowTemplate.Id;
                            NextActivity.InstanceId       = TicketSystem.InstanceId;
                            NextActivity.NextActOrder     = wfs.NextActOrder;
                            NextActivity.ActivityOrder    = wfs.ActivityOrder;
                            NextActivity.PreviousActOrder = wfs.PreviousActOrder;
                            NextActivity.ProcessRefId     = TicketSystem.Id;
                            NextActivity.Available        = true;
                            NextActivity.Assigned         = false;
                            NextActivity.Completed        = false;
                            NextActivity.BranchCode       = TicketSystem.BranchCode;
                            NextActivity.DeptCode         = TicketSystem.DeptCode;
                            PSF.SaveOrUpdate <Activity>(NextActivity);
                            TicketSystem.Status = NextActivity.ActivityName;
                            PSF.SaveOrUpdate <TicketSystem>(TicketSystem);
                        }
                    }
                    retValue = true;
                }
                return(retValue);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #18
0
    public static Ticket GetTicketDetails(string tid, string creatoremail)
    {
        TicketSystem tsystem = new TicketSystem();

        return(tsystem.SelectTicketByTicketId(tid, creatoremail));
    }