コード例 #1
0
 public RowWithHSTemplate(M_Cerificate MCertificate, string LOGOpath, string DocPath)
 {
     this.LOGOimgPath         = LOGOpath;
     this.Model               = MCertificate;
     this.CertificateSavePath = DocPath;
     this.CertificateId       = MCertificate.RefferencNo;
 }
コード例 #2
0
 public M_Cerificate getRequestDetails(string CertifiateNo)
 {
     try
     {
         M_Cerificate req = new M_Cerificate();
         using (DBLinqDataContext datacontext = new DBLinqDataContext())
         {
             datacontext.Connection.ConnectionString = Connection_;
             var result = datacontext._getCertificateStatus(CertifiateNo).SingleOrDefault();
             if (result != null)
             {
                 req.Consignor_Exporter = result.CustomerName;
                 req.InvoiceDate        = result.InvoiceDate.Value.ToString("dd/MMM/yyyy");
                 req.Consignee          = result.Consignee;
                 req.InvoiceNo          = result.InvoiceNo;
                 req.TotalInvoiceValue  = result.TotalInvoiceValue;
                 return(req);
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         return(null);
     }
 }
コード例 #3
0
        public ActionResult ApproveC(string Req, string Ctyp)
        {
            bool r = false;

            if (_session.C_Password != "")
            {
                if (Ctyp.Equals("W"))
                {
                    CRHeader = objCr.getSavedCertificateRequest(Req);
                    SupList  = objCr.getSupportingDOCfRequest(Req);
                    r        = CreateCertificate(CRHeader.TemplateId);
                }
                else if (Ctyp.Equals("U"))
                {
                    CRHeader = objCr.getUploadedCertificateRequest(Req);
                    SupList  = objCr.getSupportingDOCfRequest(Req);
                    r        = Approve_UCertificateRequest(CRHeader.Client_Id,
                                                           CRHeader.RequestReff,
                                                           CRHeader.CertificateUploadPath,
                                                           CRHeader.SealRequired);
                }
                if (r)
                {
                    return(RedirectToAction("Pending", "CertificateRequest"));
                }
                else
                {
                    return(PartialView("P_Error"));
                }
            }
            ViewBag.A_ID   = Req;
            ViewBag.A_Type = Ctyp;
            return(PartialView("P_SignatoryPassword"));
        }
コード例 #4
0
        public M_Cerificate getUploadedCertificateRequest(string RequestId)
        {
            try
            {
                M_Cerificate Cu = new M_Cerificate();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    var lst = datacontext._getUploadBCrequest(RequestId).SingleOrDefault();
                    if (lst != null)
                    {
                        Cu.Client_Id             = lst.CustomerId;
                        Cu.InvoiceNo             = lst.InvoiceNo;
                        Cu.SealRequired          = Convert.ToBoolean(lst.SealRequired);;
                        Cu.RequestReff           = lst.RequestId;
                        Cu.CertificateUploadPath = lst.UploadPath;
                    }
                }

                return(Cu);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
コード例 #5
0
        public JsonResult Approve_Certificate(M_Signatory Model)
        {
            String result = "Error";
            bool   r      = false;

            _session.C_Password = Model.Password_;
            if (Model.RequestType.Equals("W"))
            {
                CRHeader = objCr.getSavedCertificateRequest(Model.RequestID);
                SupList  = objCr.getSupportingDOCfRequest(Model.RequestID);
                r        = CreateCertificate(CRHeader.TemplateId);
            }
            else if (Model.RequestType.Equals("U"))
            {
                CRHeader = objCr.getUploadedCertificateRequest(Model.RequestID);
                SupList  = objCr.getSupportingDOCfRequest(Model.RequestID);
                r        = Approve_UCertificateRequest(CRHeader.Client_Id,
                                                       CRHeader.RequestReff,
                                                       CRHeader.CertificateUploadPath,
                                                       CRHeader.SealRequired);
            }
            if (r)
            {
                result = "Success";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public JsonResult BulkSign(M_Signatory Model)
        {
            string result = "Error";

            //var strin = new JavaScriptSerializer().DeserializeObject(Model.RequestID);
            _session.C_Password = Model.Password_;
            var strin = Model.RequestID;

            string[] arr = strin.ToString().Split(',');

            for (int a = 0; a < arr.Length; a++)
            {
                string[] s = arr[a].Split('_');
                if (s[1].Equals("U"))
                {
                    CRHeader = objCr.getUploadedCertificateRequest(s[0]);
                    SupList  = objCr.getSupportingDOCfRequest(s[0]);
                    bool r = Approve_UCertificateRequest(CRHeader.Client_Id,
                                                         CRHeader.RequestReff,
                                                         CRHeader.CertificateUploadPath,
                                                         CRHeader.SealRequired);
                    result = r.ToString();
                }
                else if (s[1].Equals("W"))
                {
                    CRHeader = objCr.getSavedCertificateRequest(s[0]);
                    SupList  = objCr.getSupportingDOCfRequest(s[0]);
                    bool r = CreateCertificate(CRHeader.TemplateId);
                    result = r.ToString();
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        public M_Cerificate getCleintNTemplate(string CustomerId, string ParentId)
        {
            try
            {
                M_Cerificate Cu = new M_Cerificate();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    var lst = datacontext.getClientTemplateNName(CustomerId, ParentId).SingleOrDefault();
                    if (lst != null)
                    {
                        Cu.Consignor_Exporter        = lst.CustomerName.Replace("<br />", "\r\n");
                        Cu.TemplateId                = lst.TemplateId;
                        Cu.Client_Id                 = lst.CustomerId;
                        Cu.ClientContact_Name        = lst.ContactPersonName;
                        Cu.ClientContact_Designation = lst.ContactPersonDesignation;
                        Cu.ClientContact_Telephone   = lst.ContactPersonDirectPhoneNumber;
                    }
                }

                return(Cu);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
コード例 #8
0
        public ActionResult LoadRefferenceByReq(string Reff)
        {
            M_Cerificate C = new M_Cerificate();

            C = objCr.getSavedCertificateRequest(Reff);
            C.Support_Docs = objCr.getTemplateSupportingDocs(C.Client_Id, C.TemplateId);
            C.SealRequired = true;
            return(PartialView("P_CertificateRequstForm", C));
        }
コード例 #9
0
 public ColumnWithHSTemplate(M_Cerificate MCertificate, string LOGOpath, string DocPath, string AuthOffer, string SignDate)
 {
     this.LOGOimgPath         = LOGOpath;
     this.Model               = MCertificate;
     this.CertificateSavePath = DocPath;
     this.CertificateId       = Model.RefferencNo;
     this.AuthoirzedOfficer   = AuthOffer;
     this.SignedDate          = SignDate;
 }
コード例 #10
0
        public ActionResult LoadUBTemplate(string Reff)
        {
            M_Cerificate C = new M_Cerificate();

            C = objCr.getCleintNTemplate(Reff, _session.Customer_ID);
            C.Support_Docs = objCr.getTemplateSupportingDocs(C.Client_Id, C.TemplateId);
            C.SealRequired = true;
            return(PartialView("P_UploadBaseCRequest", C));
        }
コード例 #11
0
 public NidroCertificateTemplate(M_Cerificate MCertificate, string LOGOpath, string DocPath, string AuthOffer, string SignedD)
 {
     this.LOGOimgPath         = LOGOpath;
     this.Model               = MCertificate;
     this.CertificateSavePath = DocPath;
     this.CertificateId       = MCertificate.RefferencNo;
     this.AuthoirzedOfficer   = AuthOffer;
     this.SignedDate          = SignedD;
 }
コード例 #12
0
 public ColumnWithHSTemplate(string CertificateID, M_Cerificate MCertificate, string LOGOpath, string DocPath, string AuthOffer, string Telephone)
 {
     this.LOGOimgPath         = LOGOpath;
     this.Model               = MCertificate;
     this.CertificateSavePath = DocPath;
     this.AuthoirzedOfficer   = AuthOffer;
     this.AuthTelephone       = Telephone;
     this.CertificateId       = CertificateID;
 }
コード例 #13
0
 public RowWithHSTemplate(string Certificateid, M_Cerificate MCertificate, string LOGOpath, string DocPath, string AuthOffer, string SignDate)
 {
     this.LOGOimgPath         = LOGOpath;
     this.Model               = MCertificate;
     this.CertificateSavePath = DocPath;
     this.CertificateId       = Certificateid;
     this.AuthoirzedOfficer   = AuthOffer;
     this.SignedDate          = SignDate;
 }
コード例 #14
0
        public string setUploadBasedCertificateRequest(M_Cerificate EmR, string Filename)
        {
            try
            {
                string certificatereqno = string.Empty;
                using (DBLinqDataContext dbContext = new DBLinqDataContext())
                {
                    dbContext.Connection.ConnectionString = Connection_;
                    dbContext.Connection.Open();

                    try
                    {
                        dbContext.Transaction = dbContext.Connection.BeginTransaction();

                        B_RecordSequence CParentId = new B_RecordSequence();
                        Int64            RequestNo = CParentId.getNextSequence("CertificateRequestNo", dbContext);
                        certificatereqno = "CRN" + RequestNo.ToString();
                        dbContext._setUploadBasedCRequests(certificatereqno,
                                                           EmR.Client_Id,
                                                           "P",
                                                           EmR.Createdby,
                                                           EmR.CertificateUploadPath + certificatereqno + "/" + Filename,
                                                           EmR.InvoiceNo,
                                                           EmR.SealRequired.ToString());
                        dbContext.SubmitChanges();
                        dbContext.Transaction.Commit();
                        return(certificatereqno);
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.LogError(ex);
                        dbContext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        dbContext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
コード例 #15
0
        public M_Cerificate getSavedCertificateRequest(string RequestId)
        {
            try
            {
                M_Cerificate Cu = new M_Cerificate();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    var lst = datacontext._getSavedCertificateRequest(RequestId).SingleOrDefault();
                    if (lst != null)
                    {
                        Cu.Consignor_Exporter = lst.Consignor.Replace("<br />", "\r\n");
                        Cu.Consignee          = lst.Consignee.Replace("<br />", "\r\n");
                        Cu.TemplateId         = lst.TemplateId;
                        Cu.Client_Id          = lst.CustomerId;
                        Cu.CountyOfOrigin     = lst.CountryCode;
                        Cu.Goods_Item         = lst.GoodItem;
                        Cu.HSCode             = lst.HSCode;
                        Cu.InvoiceDate        = lst.InvoiceDate.Value.ToString("yyyy/MMM/dd");
                        Cu.InvoiceNo          = lst.InvoiceNo;
                        Cu.OtherComments      = lst.OtherComments;
                        Cu.PackageType        = lst.PackageType;
                        Cu.PlaceOfDelivery    = lst.PlaceOfDelivery;
                        Cu.PortOfDischarge    = lst.PortOfDischarge;
                        Cu.PortOfLoading      = lst.LoadingPort;
                        Cu.QtyNUnit           = lst.Quantity;
                        Cu.Remarks            = lst.OtherDetails;
                        Cu.SealRequired       = Convert.ToBoolean(lst.SealRequired);
                        Cu.ShippingMarks      = lst.ShippingMark;
                        Cu.SummaryDescription = lst.SummaryDesc;
                        Cu.TotalInvoiceValue  = lst.TotalInvoiceValue;
                        Cu.TotalQuantity      = lst.TotalQuantity;
                        Cu.Vessel             = lst.Vessel;
                        Cu.RequestReff        = lst.RequestId;
                    }
                }

                return(Cu);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
コード例 #16
0
        public List <M_Cerificate> getAllPendingCertificateRequest(string ClientId, string ParentId)
        {
            try
            {
                List <M_Cerificate> lstSD = new List <M_Cerificate>();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    System.Data.Linq.ISingleResult <getAllPendingCertificateRequestsResult> lst = datacontext.getAllPendingCertificateRequests(ClientId, ParentId);

                    foreach (getAllPendingCertificateRequestsResult result in lst)
                    {
                        M_Cerificate SD = new M_Cerificate();
                        SD.CertificateType       = result.CertificateType;
                        SD.CertificateUploadPath = result.CertificatePath;
                        SD.Client_Id             = result.CustomerId;
                        SD.ClientContact_Company = result.CustomerName;
                        SD.Ctype               = result.CType;
                        SD.RequestReff         = result.RequestId;
                        SD.RequestDate         = result.RequestDate;
                        SD.ClientContact_Email = result.ContactPersonEmail;
                        SD.InvoiceNo           = result.InvoiceNo;
                        SD.Status              = result.Status;
                        SD.TemplateId          = result.TemplateId;
                        SD.SealRequired        = Convert.ToBoolean(result.SealRequired);
                        SD.Createdby           = result.Createdby;
                        SD.SummaryDescription  = result.SummaryDesc;
                        SD.ParentId            = result.ParentCustomer;
                        lstSD.Add(SD);
                    }
                }

                return(lstSD);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
コード例 #17
0
        public ActionResult Index(M_Cerificate Model)
        {
            B_CertificateRequest objCreq = new B_CertificateRequest();

            string r = "Error";

            Model.Createdby = _session.User_Id;
            Model.ParentId  = _session.Customer_ID;
            Model.Status    = "G";/// need to be change if the save certificate implemented including the CreateSample()

            string reff = objCreq.setCertificateRequest(Model);

            if (reff != null)
            {
                var DocumentUpload = Model.Support_Docs;
                if (DocumentUpload != null)
                {
                    string DirectoryPath = "~/Uploads/Web_SDcouments/" +
                                           DateTime.Now.ToString("yyyy") +
                                           "/" + DateTime.Now.ToString("MMM") + "/" + DateTime.Now.ToString("dd") + "/" + reff;
                    if (!Directory.Exists(Server.MapPath(DirectoryPath)))
                    {
                        Directory.CreateDirectory(Server.MapPath(DirectoryPath));
                    }
                    foreach (var Doc in DocumentUpload)
                    {
                        string             strFileUpload = "file_" + Doc.SupportingDocument_Id;
                        HttpPostedFileBase file          = Request.Files[strFileUpload];

                        if (file != null && file.ContentLength > 0)
                        {
                            var fileName = Path.GetFileName(file.FileName.Replace(" ", "_"));
                            var path     = Path.Combine(Server.MapPath(DirectoryPath), fileName);

                            M_SupportDocumentUpload Su = new M_SupportDocumentUpload();
                            Su.RequestRefNo         = reff;
                            Su.SignatureRequired    = false;
                            Su.SupportingDocumentID = Doc.SupportingDocument_Id;
                            Su.UploadedBy           = _session.User_Id;
                            Su.UploadedPath         = DirectoryPath + "/" + fileName;
                            Su.DocumentName         = fileName;
                            if (Doc.Signature_Required)
                            {
                                Su.SignatureRequired = true;
                                Su.Remarks           = "NCE_Certification";
                            }
                            else
                            {
                                Su.SignatureRequired = false;
                            }
                            objCreq.setSupportingDocumentFRequest(Su);
                            file.SaveAs(path);
                        }
                    }
                }
                CreateSample(Model, reff);
                ViewBag._Result = "Succes";
                r = "Succes";
            }

            var result = new { Msg = r, Cid = Model.Client_Id, RqId = reff };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
        public List <M_Cerificate> getCertificateRequestStatus(string requestid, string customerid, string status,
                                                               string Startdate, string Enddate, string type, string InvoiceNo)
        {
            try
            {
                List <M_Cerificate> lstpackage = new List <M_Cerificate>();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    System.Data.Linq.ISingleResult <_getCertificateRequestStatusResult> lst = datacontext._getCertificateRequestStatus(requestid,
                                                                                                                                       customerid,
                                                                                                                                       status,
                                                                                                                                       Startdate,
                                                                                                                                       Enddate,
                                                                                                                                       type,
                                                                                                                                       InvoiceNo);

                    foreach (_getCertificateRequestStatusResult result in lst)
                    {
                        string statuss = null;
                        if (result.Status.ToUpper().Equals("Y"))
                        {
                            statuss = "Yes";
                        }
                        else if (result.Status == "A")
                        {
                            statuss = "Approved";
                        }
                        else if (result.Status == "R")
                        {
                            statuss = "Reject";
                        }
                        else if (result.Status == "P")
                        {
                            statuss = "Pending";
                        }
                        else if (result.Status == "G")
                        {
                            statuss = "Pending";
                        }

                        M_Cerificate pt = new M_Cerificate();
                        pt.InvoiceNo   = result.InvoiceNo;
                        pt.Client_Id   = result.CustomerId + " : " + result.CustomerName;
                        pt.RequestReff = result.RequestId;;
                        pt.Ctype       = result.Method;
                        pt.Status      = statuss;
                        DateTime a;
                        if (result.CreatedDate == null)
                        {
                            a = DateTime.Now;
                        }
                        else
                        {
                            a = result.CreatedDate.Value;
                        }
                        pt.RequestDate = a;
                        pt.ParentId    = result.Parent;
                        lstpackage.Add(pt);
                    }
                }

                return(lstpackage);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
コード例 #19
0
        public void CreateSample(M_Cerificate Model, string Reff)
        {
            bool   Created  = false;
            string Template = Model.TemplateId;

            string LogoPath      = Server.MapPath("~/Images/NCELOGO.PNG"); // NCE Certificate logo Image path
            string DirectoryPath = "~/Temp/" + DateTime.Now.ToString("yyyy")
                                   + "/Web_Certificates/" + DateTime.Now.ToString("MMM") + "/" + DateTime.Now.ToString("dd") + "/" + Reff;

            //HeaderR.Customer_Telephone = usrSessiong.Telephone_;
            //HeaderR.CustomerName1 = usrSessiong.Customer_Name;

            //DirectoryPath which will save the NOT singed PDF File as NOT_Signed.pdf in the given Path
            if (!Directory.Exists(Server.MapPath(DirectoryPath)))
            {
                Directory.CreateDirectory(Server.MapPath(DirectoryPath));
            }

            /**PDF Cerator
             * Parameters
             * M_Certificate
             * Document Save Path
             *
             */
            if (Template.Equals(ROWWITH_HS))
            {
                RowWithHSTemplate Certificate =
                    new RowWithHSTemplate(Reff, Model, LogoPath,
                                          Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else if (Template.Equals(ROWWITHOUTHS))
            {
                RowWithoutHSTemplate Certificate =
                    new RowWithoutHSTemplate(Reff, Model, LogoPath,
                                             Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else if (Template.Equals(GOLOBALTMP))
            {
                OrientGlobalCertificateTemplate Certificate =
                    new OrientGlobalCertificateTemplate(Reff, Model, LogoPath,
                                                        Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else if (Template.Equals(MASSACTIVE))
            {
                MassActiveCertificateTemplate Certificate =
                    new MassActiveCertificateTemplate(Reff, Model, LogoPath,
                                                      Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else if (Template.Equals(NINDROTMP))
            {
                NidroCertificateTemplate Certificate =
                    new NidroCertificateTemplate(Reff, Model, LogoPath,
                                                 Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else if (Template.Equals(COLUMNWITHOUTHS))
            {
                ColumnWithoutHSTemplate Certificate =
                    new ColumnWithoutHSTemplate(Reff, Model, LogoPath,
                                                Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else if (Template.Equals(COLUMNWITHOUTHS2))
            {
                ColumnWithoutHSTemplate Certificate =
                    new ColumnWithoutHSTemplate(Reff, Model, LogoPath,
                                                Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            else
            {
                ColumnWithHSTemplate Certificate =
                    new ColumnWithHSTemplate(Reff, Model, LogoPath,
                                             Server.MapPath(DirectoryPath + "/" + Reff + "_Sample.pdf"), "", "");

                Created = Certificate.CreateCertificate("");
            }
            if (Created)
            {
                objCr.setWebBasedCertificateCreation(Reff,
                                                     DirectoryPath + "/" + Reff + "_Sample.pdf",
                                                     Reff + "_Sample.pdf");
            }
        }
コード例 #20
0
        public JsonResult Upload(M_Cerificate Model)
        {
            string r = "Error";

            Model.Createdby = _session.User_Id;
            Model.ParentId  = _session.Customer_ID;
            Model.Status    = "P";

            string             CertificateFile = "Certificate_File";
            HttpPostedFileBase Cfile           = Request.Files[CertificateFile];


            string DirectoryPath = "~/Uploads/" + DateTime.Now.ToString("yyyy")
                                   + "/Upload_Certificates/" + DateTime.Now.ToString("MMM") + "/" + DateTime.Now.ToString("dd") + "/";

            Model.CertificateUploadPath = DirectoryPath;
            string reff = string.Empty;

            if (Cfile != null && Cfile.ContentLength > 0)
            {
                reff = objCr.setUploadBasedCertificateRequest(Model, Cfile.FileName.Replace(" ", "_"));

                if (reff != null)
                {
                    DirectoryPath = DirectoryPath + reff;
                    if (!Directory.Exists(Server.MapPath(DirectoryPath)))
                    {
                        Directory.CreateDirectory(Server.MapPath(DirectoryPath));
                    }
                    var DocumentUpload = Model.Support_Docs;
                    if (DocumentUpload != null)
                    {
                        string UDirectoryPath = "~/Uploads/" + DateTime.Now.ToString("yyyy") + "/Upload_CSDcouments/"
                                                + DateTime.Now.ToString("MMM") + "/" + DateTime.Now.ToString("dd") + "/" + reff;

                        if (!Directory.Exists(Server.MapPath(UDirectoryPath)))
                        {
                            Directory.CreateDirectory(Server.MapPath(UDirectoryPath));
                        }
                        foreach (var Doc in DocumentUpload)
                        {
                            string             strFileUpload = "file_" + Doc.SupportingDocument_Id;
                            HttpPostedFileBase Ufile         = Request.Files[strFileUpload];

                            if (Ufile != null && Ufile.ContentLength > 0)
                            {
                                var fileName = Path.GetFileName(Ufile.FileName.Replace(" ", "_"));
                                var path     = Path.Combine(Server.MapPath(UDirectoryPath), fileName);

                                M_SupportDocumentUpload Su = new M_SupportDocumentUpload();
                                Su.RequestRefNo         = reff;
                                Su.SignatureRequired    = false;
                                Su.SupportingDocumentID = Doc.SupportingDocument_Id;
                                Su.UploadedBy           = _session.User_Id;
                                Su.UploadedPath         = UDirectoryPath + "/" + fileName;
                                Su.DocumentName         = fileName;
                                if (Doc.Signature_Required)
                                {
                                    Su.SignatureRequired = true;
                                    Su.Remarks           = "NCE_Certification";
                                }
                                else
                                {
                                    Su.SignatureRequired = false;
                                }

                                objCr.setSupportingDocumentFRequest(Su);

                                Ufile.SaveAs(path);
                            }
                        }
                    }
                    var CfileName = Path.GetFileName(Cfile.FileName.Replace(" ", "_"));
                    var Cpath     = Path.Combine(Server.MapPath(DirectoryPath), CfileName);
                    Cfile.SaveAs(Cpath);
                    r = "Succes";
                }
            }
            var result = new { Msg = r, Cid = Model.Client_Id, RqId = reff };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #21
0
        public string setCertificateRequest(M_Cerificate hdr)
        {
            try
            {
                string certificatereqno = string.Empty;
                using (DBLinqDataContext dbContext = new DBLinqDataContext())
                {
                    dbContext.Connection.ConnectionString = Connection_;
                    dbContext.Connection.Open();

                    try
                    {
                        dbContext.Transaction = dbContext.Connection.BeginTransaction();

                        B_RecordSequence CParentId = new B_RecordSequence();
                        Int64            RequestNo = CParentId.getNextSequence("CertificateRequestNo", dbContext);
                        certificatereqno = "CRN" + RequestNo.ToString();
                        dbContext._setCertifcateRequestHeader(certificatereqno,
                                                              hdr.TemplateId,
                                                              hdr.Client_Id,
                                                              hdr.Createdby,
                                                              hdr.Status,
                                                              hdr.Consignor_Exporter,
                                                              hdr.Consignee,
                                                              hdr.InvoiceNo,
                                                              Convert.ToDateTime(hdr.InvoiceDate),
                                                              hdr.CountyOfOrigin,
                                                              hdr.PortOfLoading,
                                                              hdr.PortOfDischarge,
                                                              hdr.Vessel,
                                                              hdr.PlaceOfDelivery,
                                                              hdr.TotalInvoiceValue,
                                                              hdr.TotalQuantity,
                                                              hdr.OtherComments,
                                                              hdr.Remarks,
                                                              hdr.SealRequired.ToString());



                        dbContext._setCertificateRequestDetails(certificatereqno,
                                                                hdr.Goods_Item,
                                                                hdr.ShippingMarks,
                                                                hdr.PackageType,
                                                                hdr.SummaryDescription,
                                                                hdr.QtyNUnit,
                                                                hdr.HSCode,
                                                                hdr.Createdby);

                        if (hdr.AddAsReff)
                        {
                            dbContext._setReffrennceRequest(hdr.Consignee, hdr.Client_Id, certificatereqno, hdr.ParentId, hdr.CTemplateName);
                        }
                        dbContext.SubmitChanges();
                        dbContext.Transaction.Commit();
                        return(certificatereqno);
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.LogError(ex);
                        dbContext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        dbContext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }