Пример #1
0
        public string SetChildCustomerRequest(M_Customer pr)
        {
            try
            {
                string PCRequesNo = 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("CustomerRequestNo", dbContext);
                        PCRequesNo = "CCRN" + RequestNo.ToString();
                        dbContext._setParentChildCustomerRequest(PCRequesNo,
                                                                 pr.Customer_Name,
                                                                 pr.Telephone,
                                                                 pr.Email,
                                                                 pr.Fax,
                                                                 "P",
                                                                 pr.Address1,
                                                                 pr.Address2,
                                                                 pr.Address3,
                                                                 pr.CreatedBy,// User Session Parent User ID Here
                                                                 pr.IsVat,
                                                                 pr.ContactPersonName,
                                                                 pr.ContactPersonDesignation,
                                                                 pr.ContactPersonDirectPhone,
                                                                 pr.ContactPersonMobile,
                                                                 pr.ContactPersonEmail,
                                                                 pr.IsNCEMember,
                                                                 pr.Parent_Id, // User Session Parent Customer ID Here
                                                                 pr.ProductDetails,
                                                                 pr.ExportSectorId);

                        dbContext.SubmitChanges();
                        dbContext.Transaction.Commit();
                        return(PCRequesNo);
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.LogError("B_Customer", ex);
                        dbContext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        dbContext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Пример #2
0
        public string setInvoiceHeader(M_InvoiceData req)
        {
            //   InvoiceDetailSaving Check = new InvoiceDetailSaving();

            string RequestId = req.RequestId;

            try
            {
                string InvoiceNo = string.Empty;

                using (DBLinqDataContext dbContext = new DBLinqDataContext())
                {
                    dbContext.Connection.ConnectionString = Connection_;
                    dbContext.Connection.Open();

                    try
                    {
                        if (req.GrossTotal != 0)
                        {
                            dbContext.Transaction = dbContext.Connection.BeginTransaction();
                            B_RecordSequence seqmanager = new B_RecordSequence();
                            Int64            RequestNo  = seqmanager.getNextSequence("InvoiceNo", dbContext);

                            InvoiceNo = "STM" + DateTime.Now.ToString("yy") + String.Format("{0:D9}", RequestNo);
                            dbContext._setInvoiceHeader(InvoiceNo,
                                                        req.CustomerId,
                                                        req.StartDate,
                                                        req.EndDate,
                                                        req.GrossTotal,
                                                        req.InvoiceTotal,
                                                        req.IsTaxInvoice,
                                                        req.Createdby,
                                                        req.PrintCount);

                            dbContext.SubmitChanges();
                            dbContext.Transaction.Commit();
                        }
                    }
                    catch (Exception ex)
                    {
                        dbContext.Transaction.Rollback();
                        ErrorLog.LogError(ex);
                    }

                    return(InvoiceNo);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(string.Empty);
            }
        }
Пример #3
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);
            }
        }
Пример #4
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);
            }
        }
Пример #5
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);
            }
        }
Пример #6
0
 public bool RejectR_NewRejectReason(M_Reject sd)
 {
     try
     {
         using (DBLinqDataContext datacontext = new DBLinqDataContext())
         {
             datacontext.Connection.ConnectionString = Connection_;
             B_RecordSequence seqmanager = new B_RecordSequence();
             Int64            rr         = seqmanager.getNextSequence("RejectCode", datacontext);
             string           rrc        = "RRC" + rr.ToString();
             datacontext._setNewRejectReason(rrc, sd.Reject_ReasonCategory, sd.Reject_ReasonName, sd.Createdby, "Y");
             datacontext.SubmitChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         return(false);
     }
 }
Пример #7
0
        public bool SDcoument_NewSDcoument(M_SupportDocument sd)
        {
            string SupDocID = string.Empty;

            try
            {
                using (DBLinqDataContext datacontext = new DBLinqDataContext())
                {
                    datacontext.Connection.ConnectionString = Connection_;
                    B_RecordSequence seqmanager = new B_RecordSequence();
                    Int64            sdid       = seqmanager.getNextSequence("SupDocID", datacontext);
                    SupDocID = "SDID" + sdid.ToString();
                    datacontext._setSupportingDocuments(SupDocID, sd.SupportingDocument_Name, sd.Created_By, "Y");
                    datacontext.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(false);
            }
        }
Пример #8
0
        public string SetApproveClientCustomerRequest(M_CustomerRequest pr)
        {
            try
            {
                string ChildCID = string.Empty;
                using (DBLinqDataContext dbContext = new DBLinqDataContext())
                {
                    dbContext.Connection.ConnectionString = Connection_;
                    dbContext.Connection.Open();

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

                        B_RecordSequence ChildID   = new B_RecordSequence();
                        Int64            RequestNo = ChildID.getNextSequence("CustomerID", dbContext);
                        ChildCID = "CC" + RequestNo.ToString();
                        dbContext._setApproveChildCustomer(pr.Request_Id,
                                                           pr.Parent_CustomerId,
                                                           ChildCID,
                                                           pr.Customer_Name,
                                                           pr.Telephone,
                                                           pr.Email,
                                                           pr.Fax,
                                                           "A",
                                                           pr.Address1,
                                                           pr.Address2,
                                                           pr.Address3,
                                                           "ADMIN",
                                                           pr.IsVat,
                                                           pr.ContactPersonName,
                                                           pr.ContactPersonDesignation,
                                                           pr.ContactPersonDirectPhone,
                                                           pr.ContactPersonMobile,
                                                           pr.ContactPersonEmail,
                                                           pr.IsNCEMember,
                                                           pr.ProductDetails,
                                                           pr.ExportSectorId.ToString(),
                                                           pr.Template_ID);

                        dbContext._setUpdateClientCustomerReq("A", pr.Request_Id);

                        dbContext.SubmitChanges();
                        dbContext.Transaction.Commit();

                        //MailSender Mail = new MailSender();
                        //Mail.SendEmail(pr.ContactPersonEmail, "NCE Client Customer Registration Approval", Parent_Approved + "  Your Client Customer Code is : " + ParentCID, " ");

                        return(ChildCID);

                        //Email Send function needed
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.LogError("B_Customer", ex);
                        dbContext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        dbContext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Пример #9
0
        public string SetCustomerParentRequest(M_CustomerParentRequest pr)
        {
            try
            {
                string PRequesNo   = string.Empty;
                string EncriptPass = Encrypt_Decrypt.Encrypt(pr.Admin_Password, Password);
                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("ParentRequestNo", dbContext);
                        PRequesNo = "PCRN" + RequestNo.ToString();
                        dbContext.DCISsetParentCustomerRequest(PRequesNo,
                                                               pr.Customer_Name,
                                                               pr.Telephone,
                                                               pr.Email,
                                                               pr.Fax,
                                                               "P",
                                                               pr.Address1,
                                                               pr.Address2,
                                                               pr.Address3,
                                                               "",
                                                               pr.IsVat,
                                                               pr.Admin_UserId,
                                                               EncriptPass,
                                                               pr.ContactPersonName,
                                                               pr.ContactPersonDesignation,
                                                               pr.ContactPersonDirectPhone,
                                                               pr.ContactPersonMobile,
                                                               pr.ContactPersonEmail,
                                                               pr.IsNCEMember,
                                                               pr.Admin_Name);

                        dbContext.SubmitChanges();
                        dbContext.Transaction.Commit();
                        return(PRequesNo);
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.LogError("B_Customer", ex);
                        dbContext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        dbContext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Пример #10
0
        public string SetApproveCustomerParentRequest(M_CustomerParentRequest pr, string createdby)
        {
            try
            {
                string ParentCID = 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("ParentCustomerId", dbContext);
                        ParentCID = "PC" + RequestNo.ToString();
                        dbContext.DCISsetApproveParentCustomer(pr.Request_Id,
                                                               ParentCID,
                                                               pr.Customer_Name,
                                                               pr.Telephone,
                                                               pr.Email,
                                                               pr.Fax,
                                                               "A",
                                                               pr.Address1,
                                                               pr.Address2,
                                                               pr.Address3,
                                                               createdby,
                                                               pr.IsVat,
                                                               pr.ContactPersonName,
                                                               pr.ContactPersonDesignation,
                                                               pr.ContactPersonDirectPhone,
                                                               pr.ContactPersonMobile,
                                                               pr.ContactPersonEmail,
                                                               pr.IsNCEMember);

                        dbContext.DCISsetUpdateParentCustomerReq("A", pr.Request_Id);
                        dbContext.DCISsetApprovedPCUser(pr.Admin_UserId, pr.Admin_Name, pr.Admin_Password, ParentCID);
                        dbContext.SubmitChanges();
                        dbContext.Transaction.Commit();

                        MailSender Mail = new MailSender();
                        Mail.SendEmail(pr.ContactPersonEmail, "NCE Registration Approval", Parent_Approved + "  Your Customer Code is : " + ParentCID, " ");

                        return(ParentCID);

                        //Email Send function needed
                    }
                    catch (Exception ex)
                    {
                        ErrorLog.LogError("B_Customer", ex);
                        dbContext.Transaction.Rollback();
                        return(null);
                    }
                    finally
                    {
                        dbContext.Connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                return(null);
            }
        }
Пример #11
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);
            }
        }