コード例 #1
0
ファイル: FileManager.cs プロジェクト: UrviGandhi/IGRSS
        /// <summary>
        /// Forward the specified File to a particular Role in a Office
        /// </summary>
        /// <param name="FileId">Id of the file that has to be forwarded</param>
        /// <param name="Designation">Designation to whom the file has to be forwarded</param>
        /// <param name="OfficeId">Id of the Office where the file has to be forwarded</param>
        public static void ForwardFile(Guid FileId, Guid Designation, Guid OfficeId, Guid OriginalAlertId)
        {
            string curUser    = Thread.CurrentPrincipal.Identity.Name;
            string link       = "";
            string Department = "";
            Dictionary <string, object> InfoList = new Dictionary <string, object>();
            string FileNumber = GetFileNo(FileId);

            if (FileNumber != "")
            {
                Department = FileNumber.Substring(0, 3);
            }
            switch (Department)
            {
            case "LIC":
                link = "~/License/LicenseApplication.aspx?Mode=View";
                break;

            case "APL":
                link = "~/Appeal/AppealApplication.aspx?Mode=ReadOnly";
                break;

            case "COM":
                link = "~/Complain/Complaint.aspx?Mode=ReadOnly";
                break;

            case "REF":
                link = "~/Refund/RefundApplication.aspx?Mode=ReadOnly";
                break;

            case "ADJ":
                //InfoList.Add(ValuationFormId, FileId);
                link = "~/Adjudication/AdjApplication.aspx?Mode=ReadOnly";
                break;
            }

            InfoList.Add("FileId", FileId);
            string Message = "A File has been forwarded by:" + curUser;

            try
            {
                StringBuilder FwdUsers = new StringBuilder();
                Guid          GroupId  = Guid.NewGuid();
                foreach (string AlertUser in WorkflowSupport.GetUserAtOfficeRole(OfficeId, Designation))
                {
                    WorkflowSupport.SendAlert(curUser, AlertUser, link, Message, InfoList, GroupId);
                    FwdUsers.Append(AlertUser + ", ");
                }
                string forwardedTo = FwdUsers.ToString().Remove(FwdUsers.ToString().Length - 2);
                IgrssAdapters.FileForwardingAdapter.AddFileForwardDetails(FileId, curUser, forwardedTo, DateTime.Now, OriginalAlertId);
                WorkflowSupport.DisableAlert(OriginalAlertId);
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, "DAL"))
                {
                    throw;
                }
            }
        }