public ApiResponse <BillingRateDetailEntity> UpdateBillingRate(List <BillingRateDetailEntity> BillingRateList)
        {
            var response = new ApiResponse <BillingRateDetailEntity>();

            string xmlData = ConvertToXml <BillingRateDetailEntity> .GetXMLString(BillingRateList, "ID,RateMainID,RateName,RegRate,DcntRate");

            try
            {
                SqlParameter[] param  = { new SqlParameter("xmlData", (object)xmlData ?? (object)DBNull.Value) };
                var            result = _repository.ExecuteSQL <BillingRateDetailEntity>("UpdateBillingRate", param).ToList();
                // var result = _repository.ExecuteSQL<AttorneyUsersEntity>("AttorneyUserGetList").ToList();
                if (result == null)
                {
                    result = new List <BillingRateDetailEntity>();
                }

                response.Success = true;
                response.Data    = result;
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #2
0
        public BaseApiResponse InsertUpdateNotification(List <NotificationEmailEntity> NotificationEmail, string OrderingAttorney, long?orderId)
        {
            var response = new BaseApiResponse();

            string xmlData = ConvertToXml <NotificationEmailEntity> .GetXMLString(NotificationEmail);

            try
            {
                SqlParameter[] param = { new SqlParameter("xmlData", (object)xmlData ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("OrderingAttorney", (object)OrderingAttorney ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("OrderId", (object)orderId ?? (object)DBNull.Value) };
                var            result = _repository.ExecuteSQL <long>("[InsertUpdateNotification]", param).FirstOrDefault();

                if (result > 0)
                {
                    response.Success        = true;
                    response.lng_InsertedId = result;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #3
0
        public BaseApiResponse InsertFirm(FirmEntity model, string EmpID, string UserID)
        {
            var response = new BaseApiResponse();

            try
            {
                string xmlData = ConvertToXml <FirmEntity> .GetXMLString(new List <FirmEntity>() { model });

                SqlParameter[] param =
                {
                    new SqlParameter("LoginEmpId", (object)EmpID ?? (object)DBNull.Value)
                    ,                              new SqlParameter("UserID", (object)UserID ?? (object)DBNull.Value)
                    ,                              new SqlParameter("xmlDataString", (object)xmlData ?? (object)DBNull.Value)
                };
                var result = _repository.ExecuteSQL <int>("InsertFirm", param).FirstOrDefault();
                if (result > 0)
                {
                    response.Success = true;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #4
0
        public ApiResponse <FirmEntity> UpdateFirm(FirmEntity model, string EmpID, string UserID)
        {
            var response = new ApiResponse <FirmEntity>();

            try
            {
                string xmlData = ConvertToXml <FirmEntity> .GetXMLString(new List <FirmEntity>() { model });

                SqlParameter[] param =
                {
                    new SqlParameter("LoginEmpId", (object)EmpID ?? (object)DBNull.Value)
                    ,                              new SqlParameter("UserID", (object)UserID ?? (object)DBNull.Value)
                    ,                              new SqlParameter("FirmID", (object)model.FirmID ?? (object)DBNull.Value)
                    ,                              new SqlParameter("xmlDataString", (object)xmlData ?? (object)DBNull.Value)
                };

                var result = _repository.ExecuteSQL <FirmEntity>("UpdateFirm", param).ToList();
                if (result == null)
                {
                    result = new List <FirmEntity>();
                }

                response.Success = true;
                response.Data    = result;
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #5
0
        public ApiResponse <AttorneyMasterEntity> UpdateAttorney(AttorneyMasterEntity model, string LoginEmpId, int UserID)
        {
            var response = new ApiResponse <AttorneyMasterEntity>();

            try
            {
                string XmlAssistantContact = "";
                if (model.AttorneyAssistantContactList != null && model.AttorneyAssistantContactList.Count > 0)
                {
                    XmlAssistantContact = ConvertToXml <AttorneyAssistantContact> .GetXMLString(model.AttorneyAssistantContactList);
                }
                string xmlData = ConvertToXml <AttorneyMasterEntity> .GetXMLString(new List <AttorneyMasterEntity>() { model });

                SqlParameter[] param = { new SqlParameter("LoginEmpId", (object)LoginEmpId ?? (object)DBNull.Value)
                                         ,                              new SqlParameter("UserID", (object)UserID ?? (object)DBNull.Value)
                                         ,                              new SqlParameter("LocID", (object)model.AttyID ?? (object)DBNull.Value)
                                         ,                              new SqlParameter("xmlDataString", (object)xmlData ?? (object)DBNull.Value)
                                         ,                              new SqlParameter("xmlAssistantContact", (object)XmlAssistantContact ?? (object)DBNull.Value) };

                var result = _repository.ExecuteSQL <int>("UpdateAttorney", param).FirstOrDefault();
                if (result > 0)
                {
                    // result = new List<AttorneyMasterEntity>();
                    response.Success = true;
                }

                return(response);
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #6
0
        public ApiResponse <LocationEntity> UpdateLocation(LocationEntity model, string LoginEmpId)
        {
            var response = new ApiResponse <LocationEntity>();

            try
            {
                model.strChngDate     = Common.CommonHelper.GetCustomDateStringForXML(model.ChngDate);
                model.strEntDate      = Common.CommonHelper.GetCustomDateStringForXML(model.EntDate);
                model.strLastUsedDate = Common.CommonHelper.GetCustomDateStringForXML(model.LastUsedDate);

                string xmlData = ConvertToXml <LocationEntity> .GetXMLString(new List <LocationEntity>() { model });

                SqlParameter[] param = { new SqlParameter("LoginEmpId", (object)LoginEmpId ?? (object)DBNull.Value)
                                         ,                              new SqlParameter("LocID", (object)model.LocID ?? (object)DBNull.Value)
                                         ,                              new SqlParameter("xmlDataString", (object)xmlData ?? (object)DBNull.Value) };

                var result = _repository.ExecuteSQL <LocationEntity>("UpdateLocation", param).ToList();
                if (result == null)
                {
                    result = new List <LocationEntity>();
                }
                response.Success = true;
                response.Data    = result;
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
        public BaseApiResponse SaveWaiver(long OrderId, List <WaiverEntity> waiverlist)
        {
            var response = new BaseApiResponse();

            try
            {
                string xmlData = ConvertToXml <WaiverEntity> .GetXMLString(waiverlist);

                SqlParameter[] param = { new SqlParameter("xmlData", (object)xmlData ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("OrderId", (object)OrderId ?? (object)DBNull.Value) };
                var            result = _repository.ExecuteSQL <long>("InsertUpdateWaiver", param).FirstOrDefault();

                if (result > 0)
                {
                    response.Success        = true;
                    response.lng_InsertedId = result;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }

            return(response);
        }
예제 #8
0
        public BaseApiResponse RemoveCallBackFromNote(OrderPartNoteEntity modal)
        {
            string OrderIdsWithPartIdsXML = ConvertToXml <OrderIdsPartIds> .GetXMLString(modal.OrderIdPartIdList);

            var response = new BaseApiResponse();

            try
            {
                //Guid UserId = new Guid(modal.UserId);
                SqlParameter[] param = { new SqlParameter("UserId", (object)modal.UserId ?? (object)DBNull.Value)
                                         ,                          new SqlParameter("OrderIdsWithPartIdsXML", (object)OrderIdsWithPartIdsXML ?? (object)DBNull.Value) };
                var            result = _repository.ExecuteSQL <int>("RemoveCallBackForSelected", param).FirstOrDefault();
                if (result == 1)
                {
                    response.Success = true;
                }
                else
                {
                    response.Success = false;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #9
0
        public BaseApiResponse AddOrUpdateRoleConfiguration(int UserAccessId, List <RoleRightsEntity> RoleRightsCollection)
        {
            var    response            = new BaseApiResponse();
            string getRoleRightsxmlstr = ConvertToXml <RoleRightsEntity> .GetXMLString(RoleRightsCollection);

            try
            {
                SqlParameter[] param = { new SqlParameter("RoleRightsCollection", (object)getRoleRightsxmlstr ?? (object)DBNull.Value)
                                         ,                                        new SqlParameter("UserAccessId", (object)UserAccessId ?? (object)DBNull.Value) };

                var result = _repository.ExecuteSQL <int>("AddOrUpdateRoleRights", param).FirstOrDefault();

                response.Success    = result > 0;
                response.InsertedId = result;
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }

            return(response);
        }
예제 #10
0
        public async Task <BaseApiResponse> SubmitOrder(OrderWizardStep1 model)
        {
            var response = new BaseApiResponse();

            // IF NO LOCATION IS INSERTED DURING NEW ORDER THEN ASSIGN DEFAULT LOCATION

            int partCount = 0;

            SqlParameter[] paramPartCount = { new SqlParameter("OrderNo", (object)model.OrderId ?? (object)DBNull.Value) };

            partCount = _repository.ExecuteSQL <int>("CountTotalPartByOrderNo", paramPartCount).FirstOrDefault();


            if (partCount == 0)
            {
                int recordType = 4; // Billing Records
                try
                {
                    string defaultLocation = GetDefaultLocationByCompanyNo(model.CompanyNo);

                    OrderWizardStep3 resultStep3 = new OrderWizardStep3();

                    SqlParameter[] paramStep3 = { new SqlParameter("OrderId", (object)model.OrderId ?? (object)DBNull.Value) };
                    resultStep3 = _repository.ExecuteSQL <OrderWizardStep3>("GetOrderWizardStep3Details", paramStep3).FirstOrDefault();



                    SqlParameter[] paramScope = { new SqlParameter("OrderNo", (object)model.OrderId ?? (object)DBNull.Value)
                                                  ,                           new SqlParameter("RecType", (object)recordType ?? (object)DBNull.Value) };

                    string resultScope = _repository.ExecuteSQL <string>("GetScopeForLocation", paramScope).FirstOrDefault();



                    OrderWizardStep6 defaultPart = new OrderWizardStep6();
                    defaultPart.OrderId         = Convert.ToInt64(model.OrderId);
                    defaultPart.LocID           = defaultLocation;
                    defaultPart.EmpId           = model.EmpId;
                    defaultPart.IsAuthorization = true;
                    defaultPart.RecordTypeId    = recordType;
                    defaultPart.RequestMeansId  = 1;
                    defaultPart.ScopeStartDate  = resultStep3.DateOfBirth;
                    defaultPart.ScopeEndDate    = DateTime.Now.Date;
                    defaultPart.Scope           = resultScope;

                    OrderWizardStep6ApiController step6 = new OrderWizardStep6ApiController();
                    await step6.InsertOrUpdateOrderWizardStep6(defaultPart);
                }
                catch (Exception ex)
                {
                }
            }


            try
            {
                if (model.OrderId > 0)
                {
                    SqlParameter[] Sqlparam    = { new SqlParameter("OrderId", (object)model.OrderId ?? (object)DBNull.Value) };
                    var            orderResult = _repository.ExecuteSQL <OrderWizardStep1>("GetOrderWizardStep1Details", Sqlparam).ToList();
                    if (orderResult != null && orderResult.Count > 0)
                    {
                        model.SubmitStatus = orderResult[0].SubmitStatus;
                    }
                    int result = 0;
                    try
                    {
                        SqlParameter[] param = { new SqlParameter("OrderId", (object)model.OrderId ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("UpdatedBy", (object)model.EmpId ?? (object)DBNull.Value)
                                                 ,                           new SqlParameter("UserAccessId", (object)model.UserAccessId ?? (object)DBNull.Value) };

                        result = _repository.ExecuteSQL <int>("SubmitOrder", param).FirstOrDefault();
                    }
                    catch (Exception ex)
                    {
                    }
                    if (result > 0)
                    {
                        //Upload Location Documents on Final Submit
                        SqlParameter[] SqlFileparam = { new SqlParameter("OrderNo", (object)model.OrderId ?? (object)DBNull.Value),
                                                        new SqlParameter("PartNo",  (object)0 ?? (object)DBNull.Value) };
                        var            LocDocumentList = _repository.ExecuteSQL <LocationFilesModel>("GetLocationTempFilesForNewOrder", SqlFileparam).ToList();
                        if (LocDocumentList != null && LocDocumentList.Count > 0)
                        {
                            string sourcePath      = ConfigurationManager.AppSettings["AttachPathLocal"].ToString();
                            string destinationPath = ConfigurationManager.AppSettings["UploadRoot"].ToString();
                            foreach (var item in LocDocumentList)
                            {
                                SqlParameter[] deleteattachparam =
                                {
                                    new SqlParameter("OrderNo",           (object)model.OrderId ?? (object)DBNull.Value),
                                    new SqlParameter("PartNo",            (object)item.PartNo ?? (object)DBNull.Value),
                                    new SqlParameter("FileTypeId",        (object)item.FileTypeId ?? (object)DBNull.Value),
                                    new SqlParameter("DeleteFromLocFile", (object)(int)0 ?? (object)DBNull.Value),
                                    new SqlParameter("LocFileId",         (object)(int)0 ?? (object)DBNull.Value)
                                };
                                _repository.ExecuteSQL <int>("DeleteLocationFile", deleteattachparam).FirstOrDefault();
                            }
                            foreach (var docitem in LocDocumentList)
                            {
                                var    destPath     = destinationPath + "/" + docitem.OrderNo + "/" + docitem.PartNo;
                                string fileDiskName = new Document().MoveLocalToServerFile(docitem.FileName, docitem.BatchId, sourcePath, destPath, docitem.OrderNo, docitem.PartNo.ToString());
                                docitem.OrderNo      = Convert.ToInt32(docitem.OrderNo);
                                docitem.FileDiskName = fileDiskName;
                                docitem.Pages        = 0;
                                string xmlAttachData = ConvertToXml <LocationFilesModel> .GetXMLString(new List <LocationFilesModel>() { docitem });

                                SqlParameter[] attachparam = { new SqlParameter("xmlDataString", (object)xmlAttachData ?? (object)DBNull.Value) };
                                _repository.ExecuteSQL <int>("InsertFiles", attachparam).FirstOrDefault();
                            }
                            foreach (var docitem in LocDocumentList)
                            {
                                Document docobj = new Document();
                                docobj.DeleteAttchFile(docitem.FileName, docitem.BatchId, sourcePath);
                            }
                            SqlParameter[] deleteLocationFile =
                            {
                                new SqlParameter("OrderNo", (object)model.OrderId ?? (object)DBNull.Value)
                            };
                            _repository.ExecuteSQL <int>("DeleteLocationFileByOrderNo", deleteLocationFile).FirstOrDefault();
                        }

                        await new OrderProcess().OrderSummaryEmail(Convert.ToInt32(model.OrderId), model.UserEmail, model.CompanyNo, Convert.ToInt32(model.SubmitStatus));
                        await new OrderProcess().AddQuickformsForNewOrder(Convert.ToInt32(model.OrderId), Convert.ToBoolean(model.SubmitStatus), Convert.ToBoolean(model.SubmitStatus), logoDirectoryPath: HttpContext.Current.Server.MapPath(@"~/assets/images/"));

                        // await new OrderProcess().ESignature(Convert.ToInt32(model.OrderId), model.CompanyNo);

                        InsertWaiverForNewOrder(Convert.ToInt32(model.OrderId));

                        // UPDATE isAddedPart TO 0 OF ALL PART AFTER PROCESSING ORDER
                        SqlParameter[] paramAddedPart  = { new SqlParameter("OrderNo", (object)model.OrderId ?? (object)DBNull.Value) };
                        int            resultAddedPart = _repository.ExecuteSQL <int>("SubmitOrderUpdateisAddedPart", paramAddedPart).FirstOrDefault();

                        response.Success = true;
                    }
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }

            return(response);
        }
예제 #11
0
        public ApiResponse <GenerateInvoiceEntity> GenerateInvoice(Int64 OrderNo, int PartNo, string BillToAttorney, int CompanyNo, List <SoldAttorneyEntity> SoldAtty, int RecordTypeID = 0, int FileVersionID = 0, bool isFromBillingProposal = false)
        {
            var    response = new ApiResponse <GenerateInvoiceEntity>();
            string xmlData  = ConvertToXml <SoldAttorneyEntity> .GetXMLString(SoldAtty);

            CompanyDetailForEmailEntity objCompany = CommonFunction.CompanyDetailForEmail(CompanyNo);

            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("OrderNo", (object)OrderNo ?? (object)DBNull.Value)
                    ,                           new SqlParameter("PartNo", (object)PartNo ?? (object)DBNull.Value)
                    ,                           new SqlParameter("BillAttorney", (object)BillToAttorney ?? (object)DBNull.Value)
                    ,                           new SqlParameter("SoldAttorneyAndAttorneyType", (object)xmlData ?? (object)DBNull.Value)
                };
                var result = _repository.ExecuteSQL <GenerateInvoiceEntity>("GenerateInvoice", param).ToList();
                if (isFromBillingProposal)
                {
                    response.Success = true;
                    response.Data    = result;
                    return(response);
                }


                if (result.Count > 0)
                {
                    SqlParameter[] BillingProposalParam =
                    {
                        new SqlParameter("OrderNo", (object)OrderNo ?? (object)DBNull.Value)
                        ,                           new SqlParameter("PartNo", (object)PartNo ?? (object)DBNull.Value)
                    };
                    List <BillingProposalAttorneyEntity> resultBillingProposal = new List <BillingProposalAttorneyEntity>();
                    resultBillingProposal = _repository.ExecuteSQL <BillingProposalAttorneyEntity>("BillingProposalAttorny", BillingProposalParam).ToList();

                    foreach (BillingProposalAttorneyEntity item in resultBillingProposal)
                    {
                        // RecordTypeID = 41 (Cancelled)
                        // RecordTypeID = 137 (No Records)

                        if (RecordTypeID == 41 || RecordTypeID == 137)
                        {
                            continue;
                        }
                        string subject = "Billing Proposal " + Convert.ToString(OrderNo);
                        string body    = string.Empty;
                        using (System.IO.StreamReader reader = new System.IO.StreamReader(HttpContext.Current.Server.MapPath("~/MailTemplate/WaiverBillingProposal.html")))
                        {
                            body = reader.ReadToEnd();
                        }
                        if (!string.IsNullOrEmpty(item.AttorneyFirstname))
                        {
                            body = body.Replace("{Attorney}", Convert.ToString(item.AttorneyFirstname) + " " + Convert.ToString(item.AttorneyLastName).Trim());
                            body = body.Replace("{Firm}", Convert.ToString(result[0].FirmName).Trim());
                        }
                        body = body.Replace("{caption}", Convert.ToString(result[0].Caption).Trim());
                        body = body.Replace("{RECORDSOF}", Convert.ToString(result[0].Patient).Trim());

                        body = body.Replace("{UserName}", Convert.ToString(item.AttorneyFirstname).Trim() + " " + Convert.ToString(item.AttorneyLastName).Trim());
                        body = body.Replace("{ORDERNO}", OrderNo.ToString());

                        body = body.Replace("{LOCATION}", Convert.ToString(result[0].LocationName).Replace(',', ' ') + " (" + Convert.ToString(result[0].LocID) + ")");
                        //  body = body.Replace("{RecordType}", location.Descr.Trim());
                        body = body.Replace("{RecordType}", Convert.ToString(result[0].Descr));//INVHdr OF Item TABLE
                        body = body.Replace("{PAGES}", Convert.ToString(result[0].Pages));

                        double totalCost = 0;
                        totalCost = (result[0].Pages * 0.25) + 10;
                        body      = body.Replace("{COST}", Convert.ToString(totalCost.ToString("F")));


                        body = body.Replace("{LogoURL}", objCompany.Logopath);
                        body = body.Replace("{ThankYou}", objCompany.ThankYouMessage);
                        body = body.Replace("{CompanyName}", objCompany.CompName);
                        body = body.Replace("{Link}", objCompany.SiteURL);

                        string accExecutiveName  = "Admin";
                        string accExecutiveEmail = "*****@*****.**";

                        string AttorneyNm = Convert.ToString(item.AttorneyFirstname).Trim() + " " + Convert.ToString(item.AttorneyLastName).Trim() + " (" + Convert.ToString(item.AttorneyEmail).Trim() + ")";


                        string orderNo   = OrderNo.ToString();
                        string strPages  = result[0].Pages.ToString();
                        string strAmount = totalCost.ToString(); //result[0].TotalAmountForPatientAtty.ToString();
                        string WaiverID  = string.Empty;

                        string strApproveLink, strNotApprovedLink, strEditScopeLink, strQueryString;
                        strQueryString     = accExecutiveEmail + "," + accExecutiveName + "," + orderNo + "," + result[0].LocationName.Replace(',', ' ') + " (" + result[0].LocID + ")" + "," + strPages + "," + strAmount + "," + PartNo.ToString() + "," + AttorneyNm + "," + item.AttyID + "," + FileVersionID;
                        strApproveLink     = HttpUtility.UrlEncode(EncryptDecrypt.Encrypt(strQueryString));
                        strNotApprovedLink = HttpUtility.UrlEncode(EncryptDecrypt.Encrypt(strQueryString));
                        strEditScopeLink   = HttpUtility.UrlEncode(EncryptDecrypt.Encrypt(strQueryString));


                        string BaseLink = objCompany.SiteURL + "BillingProposal?type=";

                        body = body.Replace("{YESLINK}", BaseLink + HttpUtility.UrlEncode(EncryptDecrypt.Encrypt("Y")) + "&value=" + strApproveLink);
                        body = body.Replace("{NOLINK}", BaseLink + HttpUtility.UrlEncode(EncryptDecrypt.Encrypt("N")) + "&value=" + strNotApprovedLink);

                        EmailHelper.Email.Send(CompanyNo: objCompany.CompNo
                                               , mailTo: item.AttorneyEmail
                                               , body: body
                                               , subject: subject
                                               , ccMail: ""
                                               , bccMail: "[email protected],[email protected]");
                    }
                }
                response.Success = true;
                response.Data    = result;
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }
예제 #12
0
        public BaseApiResponse InsertOrderPartNotes(OrderPartNoteEntity modal)
        {
            string OrderIdsWithPartIdsXML = ConvertToXml <OrderIdsPartIds> .GetXMLString(modal.OrderIdPartIdList);

            CompanyDetailForEmailEntity objCompany = CommonFunction.CompanyDetailForEmailByOrderNo(Convert.ToString(modal.OrderId));

            var response = new BaseApiResponse();

            try
            {
                Guid           UserId = new Guid(modal.UserId);
                SqlParameter[] param  = { new SqlParameter("OrderId", (object)modal.OrderId ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("PartNo", (object)modal.PartNo ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("NotesClient", (object)modal.NotesClient ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("NotesInternal", (object)modal.NotesInternal ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("CallBack", (object)modal.CallBack ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("CanDate", (object)modal.CanDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("DueDate", (object)modal.DueDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("EntDate", (object)modal.EntDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("FirstCall", (object)modal.FirstCall ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("HoldDate", (object)modal.HoldDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("NRDate", (object)modal.NRDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("OrdDate", (object)modal.OrdDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("AuthRecDate", (object)modal.AuthRecDate ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("PartStatusId", (object)modal.PartStatusId ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("AssgnTo", (object)modal.AssgnTo ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("InternalStatusId", (object)modal.InternalStatusId ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("InternalStatusText", (object)modal.InternalStatusText ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("UserId", (object)UserId ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("PageFrom", (object)modal.PageFrom ?? (object)DBNull.Value)
                                          ,                            new SqlParameter("OrderIdsWithPartIdsXML", (object)OrderIdsWithPartIdsXML ?? (object)DBNull.Value) };
                var            result = _repository.ExecuteSQL <int>("InsertOrderPartNotes", param).FirstOrDefault();

                SqlParameter[] paramAuth = { new SqlParameter("Orderno", (object)modal.OrderId ?? (object)DBNull.Value)
                                             ,                           new SqlParameter("PartNo", (object)modal.PartNo ?? (object)DBNull.Value)
                                             ,                           new SqlParameter("Status", (object)modal.AssgnTo ?? (object)DBNull.Value) };

                var resultAuth = _repository.ExecuteSQL <int>("AuthorizationToBeCalledInsert", paramAuth).FirstOrDefault();

                if (result == 1)
                {
                    if (!string.IsNullOrEmpty(modal.RoleName) && modal.RoleName == "Attorney")
                    {
                        string accExecutiveName  = string.Empty;
                        string accExecutiveEmail = string.Empty;


                        SqlParameter[] param1     = { new SqlParameter("UserId", (object)UserId ?? (object)DBNull.Value) };
                        var            MailDetail = _repository.ExecuteSQL <AccountExecutive>("GetClientAcctExec", param1).FirstOrDefault();
                        if (MailDetail != null)
                        {
                            accExecutiveName  = Convert.ToString(MailDetail.Name);
                            accExecutiveEmail = Convert.ToString(MailDetail.Email);
                        }
                        else
                        {
                            accExecutiveName  = "Leah Boroski";
                            accExecutiveEmail = "*****@*****.**";
                        }

                        string subject = "Client Note Added " + Convert.ToString(modal.OrderId) + "-" + Convert.ToString(modal.PartNo);
                        System.Text.StringBuilder htmlBody = new System.Text.StringBuilder();
                        htmlBody.Append(@"<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'><head><title></title><style>table, th, td {border: 1px solid gray;font-family:Verdana;}</style></head>");
                        htmlBody.Append(@"<body style='font-family:Verdana;'>");
                        htmlBody.Append(@"##MESSAGE##");
                        htmlBody.Append(@"<table align='left' style='width:650px;'cellpadding='5' cellspacing='0'>");
                        htmlBody.Append(@"<tr><td align='right' style='width:120px;'><b>Order No :</b></td><td>##ORDERNO##</td></tr>");
                        htmlBody.Append(@"<tr><td align='right'><b>Note :</b></td><td>##NOTE##</td></tr>");
                        htmlBody.Append(@"</table></body></html>");
                        htmlBody.Replace("##MESSAGE##", accExecutiveName + ", <br />Client has added new note.<br /><br />");
                        htmlBody.Replace("##ORDERNO##", modal.OrderId + "-" + modal.PartNo);
                        htmlBody.Replace("##NOTE##", modal.NotesClient);
                        EmailHelper.Email.Send(CompanyNo: objCompany.CompNo
                                               , mailTo: accExecutiveEmail
                                               , body: htmlBody.ToString()
                                               , subject: subject
                                               , ccMail: ""
                                               , bccMail: "[email protected],[email protected]");
                    }
                    response.Success    = true;
                    response.InsertedId = result;
                }
                else
                {
                    response.Success = false;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }
            return(response);
        }