Ejemplo n.º 1
0
        public List <M_SupportDocumentUpload> getPendingSDRequests(string ClientId, string Status, string Parent)
        {
            try
            {
                List <M_SupportDocumentUpload> lstSD = new List <M_SupportDocumentUpload>();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    System.Data.Linq.ISingleResult <_getPendingSDocApprovalsResult> lst = datacontext._getPendingSDocApprovals(Status, ClientId, Parent);

                    foreach (_getPendingSDocApprovalsResult result in lst)
                    {
                        M_SupportDocumentUpload SD = new M_SupportDocumentUpload();
                        SD.RequestRefNo         = result.RequestID;
                        SD.SupportingDocumentID = result.SupportingDocID;
                        SD.DocumentName         = result.SupportingDocumentName;
                        SD.ClientId             = result.CustomerID + " : " + result.CustomerName;
                        SD.UploadedDate         = result.RequestDate.Value.ToString("dd/MMM/yyyy");
                        SD.UploadedBy           = result.RequestBy;
                        SD.ParentId             = result.ParentName;
                        SD.UploadedPath         = result.UploadPath;
                        SD.DocumentTitle        = result.UploadDocName;
                        lstSD.Add(SD);
                    }
                }

                return(lstSD);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Ejemplo n.º 2
0
        public M_SupportDocumentUpload getSDocbyID(string RequestId)
        {
            try
            {
                M_SupportDocumentUpload SD = new M_SupportDocumentUpload();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    var result = datacontext._getPendingSDoc_byID(RequestId).SingleOrDefault();
                    if (result != null)
                    {
                        SD.RequestRefNo         = result.RequestID;
                        SD.SupportingDocumentID = result.SupportingDocID;
                        SD.DocumentName         = result.SupportingDocumentName;
                        SD.ClientId             = result.CustomerID + " : " + result.CustomerName;
                        SD.UploadedDate         = result.RequestDate.Value.ToString("dd/MMM/yyyy");
                        SD.UploadedBy           = result.RequestBy;
                        SD.ParentId             = result.ParentName;
                        SD.UploadedPath         = result.UploadPath;
                        SD.DocumentTitle        = result.UploadDocName;
                    }
                }

                return(SD);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Ejemplo n.º 3
0
        public List <M_SupportDocumentUpload> getSupportingDOCfRequest(string ID)
        {
            try
            {
                List <M_SupportDocumentUpload> DocList = new List <M_SupportDocumentUpload>();
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    System.Data.Linq.ISingleResult <_getCRequestSupportingDOCResult> lst = datacontext._getCRequestSupportingDOC(ID);
                    foreach (_getCRequestSupportingDOCResult result in lst)
                    {
                        M_SupportDocumentUpload SUP = new M_SupportDocumentUpload();
                        SUP.SupportingDocumentID = result.SupportingDocumentId;
                        SUP.Remarks           = result.Remarks;
                        SUP.RequestRefNo      = result.RequestRefNo;
                        SUP.UploadedBy        = result.UploadedBy;
                        SUP.UploadedPath      = result.UploadedPath;
                        SUP.DocumentName      = result.DocumentName;
                        SUP.Seq_No            = result.UploadSeqNo;
                        SUP.DocumentTitle     = result.SupportingDocumentName;
                        SUP.UploadedDate      = result.RequestDate.ToString();
                        SUP.SignatureRequired = Convert.ToBoolean(result.SignatureRequired);

                        DocList.Add(SUP);
                    }
                }
                return(DocList);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Ejemplo n.º 4
0
        public string setSupportingDocSignRequestINCertRequest(M_SupportDocumentUpload hdr)
        {
            try
            {
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    datacontext.Connection.Open();

                    try
                    {
                        B_RecordSequence seqmanager = new B_RecordSequence();
                        datacontext.Transaction = datacontext.Connection.BeginTransaction();
                        long No = Convert.ToInt64(seqmanager.getNextSequence("SupportingDocSignRq"));
                        if (No == 0)
                        {
                            return(null);
                        }
                        string Doc_No = "SDR" + No.ToString();
                        datacontext._setSupportingDocApproveFrmCRquest(Doc_No,
                                                                       hdr.SupportingDocumentID,
                                                                       hdr.ClientId,
                                                                       hdr.UploadedBy,
                                                                       hdr.Status,
                                                                       hdr.UploadedPath,
                                                                       hdr.DocumentName,
                                                                       hdr.ApprovedBy,
                                                                       Convert.ToDateTime(hdr.UploadedDate),
                                                                       hdr.CertifiedDocPathe,
                                                                       Convert.ToDateTime(hdr.ExpiredOn),
                                                                       hdr.RequestRefNo);
                        datacontext.SubmitChanges();
                        datacontext.Transaction.Commit();
                        return(Doc_No);
                    }
                    catch (Exception Ex)
                    {
                        ErrorLog.LogError(Ex);
                        datacontext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        datacontext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Ejemplo n.º 5
0
        private bool Sign_SDocument(string Ref, string UPath)
        {
            bool   result        = false;
            string DirectoryPath = "~/Documents/" + DateTime.Now.ToString("yyyy")
                                   + "/Issued_SupportingDocs/" + DateTime.Now.ToString("MMM") + "/" + DateTime.Now.ToString("dd") + "/"
                                   + Ref;

            string Tempary_Direct = "~/Temp/" + DateTime.Now.ToString("yyyy")
                                    + "/Issued_SupportingDocs/" + DateTime.Now.ToString("yyyy_MM_dd") + "/"
                                    + Ref;

            if (!Directory.Exists(Server.MapPath(DirectoryPath)))
            {
                Directory.CreateDirectory(Server.MapPath(DirectoryPath));
            }
            if (!Directory.Exists(Server.MapPath(Tempary_Direct)))
            {
                Directory.CreateDirectory(Server.MapPath(Tempary_Direct));
            }

            string Sealed = Server.MapPath(Tempary_Direct + "/" + Ref + "_Seald.pdf");
            string Signed = Server.MapPath(DirectoryPath + "/" + Ref + "_Signed.pdf");
            string pathe  = Server.MapPath(_session.PFX_path);

            Sign_ SignDoc = new Sign_();

            SignDoc.AddSealSD(Server.MapPath(UPath), Sealed, Server.MapPath(_session.SignatureIMG_Path));

            var PFX2 = new FileStream(pathe, FileMode.OpenOrCreate);

            bool Sign = SignDoc.signSupportingDoc(Ref,
                                                  Sealed,
                                                  Signed,
                                                  PFX2, _session.C_Password);

            if (Sign)
            {
                M_SupportDocumentUpload Approve = new M_SupportDocumentUpload();
                Approve.DocumentName      = Ref + "_Signed.pdf";
                Approve.CertifiedDocPathe = DirectoryPath + "/" + Ref + "_Signed.pdf";
                Approve.ApprovedBy        = _session.User_Id;
                Approve.RequestRefNo      = Ref;
                Approve.ExpiredOn         = DateTime.Today.AddDays(120).ToString();
                //Approve.RequestRefNo = lblApporveRequestID.Text;
                result = objSDApprv.ApproveSupportingDoc(Approve);
            }
            PFX2.Close();
            return(result);
        }
Ejemplo n.º 6
0
        public ActionResult Approve_Support(M_Signatory Model)
        {
            M_SupportDocumentUpload SModel = objSDApprv.getSDocbyID(Model.RequestID);
            string r = "Error";

            _session.C_Password = Model.Password_;
            if (SModel != null)
            {
                bool rr = Sign_SDocument(SModel.RequestRefNo, SModel.UploadedPath);
                if (rr)
                {
                    r = "Sucess";
                }
            }
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
 public bool UpdateSupportingDocCertified(M_SupportDocumentUpload SD)
 {
     try
     {
         using (DBLinqDataContext datacontext = new DBLinqDataContext())
         {
             datacontext.Connection.ConnectionString = Connection_;
             datacontext._setUpdateSupportingDocUpload(SD.Seq_No, SD.UploadedPath, SD.DocumentName);
             return(true);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         return(false);
     }
 }
Ejemplo n.º 8
0
 public bool setSupportingDocumentFRequest(M_SupportDocumentUpload usr)
 {
     try
     {
         using (DBLinqDataContext datacontext = new DBLinqDataContext())
         {
             datacontext.Connection.ConnectionString = Connection_;
             datacontext._setSupportingDocUpload(usr.RequestRefNo, usr.SupportingDocumentID, usr.Remarks, usr.UploadedBy, usr.UploadedPath, usr.DocumentName, usr.SignatureRequired.ToString());
             return(true);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         return(false);
     }
 }
Ejemplo n.º 9
0
        public JsonResult BulkSign(M_Signatory Model)
        {
            bool r = false;

            _session.C_Password = Model.Password_;
            var strin = Model.RequestID;

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

            for (int a = 0; a < arr.Length; a++)
            {
                M_SupportDocumentUpload SModel = objSDApprv.getSDocbyID(arr[a]);
                _session.C_Password = Model.Password_;
                r = Sign_SDocument(SModel.RequestRefNo, SModel.UploadedPath);
            }
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public string setSupportingDocSignRequest(M_SupportDocumentUpload Model)
        {
            try
            {
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    datacontext.Connection.Open();

                    try
                    {
                        B_RecordSequence seqmanager = new B_RecordSequence();
                        datacontext.Transaction = datacontext.Connection.BeginTransaction();
                        string Doc_No = "SDR" + seqmanager.getNextSequence("SupportingDocSignRq", datacontext);
                        datacontext._setSupportingDocApproveRequest(Doc_No,
                                                                    Model.SupportingDocumentID,
                                                                    Model.ClientId,
                                                                    Model.UploadedBy,
                                                                    Model.Status,
                                                                    Model.UploadedPath + "/" + Doc_No + "/" + Model.DocumentName,
                                                                    Model.DocumentName);
                        datacontext.SubmitChanges();
                        datacontext.Transaction.Commit();
                        return(Doc_No);
                    }
                    catch (Exception Ex)
                    {
                        ErrorLog.LogError(Ex);
                        datacontext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        datacontext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Ejemplo n.º 11
0
 public bool ApproveSupportingDoc(M_SupportDocumentUpload SD)
 {
     try
     {
         using (DBLinqDataContext datacontext = new DBLinqDataContext())
         {
             datacontext.Connection.ConnectionString = Connection_;
             datacontext._setUpdateSDApproveReq(SD.RequestRefNo,
                                                SD.ApprovedBy,
                                                SD.CertifiedDocPathe,
                                                SD.DocumentName,
                                                Convert.ToDateTime(SD.ExpiredOn));
             datacontext.SubmitChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         return(false);
     }
 }
Ejemplo n.º 12
0
        public JsonResult Supporting(M_SupportDocumentUpload Model)
        {
            string r = "Error";

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

            string             SDocument_file = "Document_File";
            HttpPostedFileBase Cfile          = Request.Files[SDocument_file];

            Model.UploadedBy   = _session.User_Id; // Client's User;
            Model.Status       = "P";
            Model.UploadedPath = DirectoryPath;
            Model.DocumentName = Cfile.FileName.Replace(" ", "_");

            string reff = string.Empty;

            if (Cfile != null && Cfile.ContentLength > 0)
            {
                reff = objCr.setSupportingDocSignRequest(Model);
                if (reff != null)
                {
                    DirectoryPath = DirectoryPath + "/" + reff;
                    if (!Directory.Exists(Server.MapPath(DirectoryPath)))
                    {
                        Directory.CreateDirectory(Server.MapPath(DirectoryPath));
                    }
                    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, RqId = reff };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 13
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));
        }
Ejemplo n.º 14
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));
        }