public string SaveRFPProcessing(RFProcessing objRFProcessing)
        {
            int       vResult         = 0;
            int       vApprovalResult = 0;
            string    vOut            = "Exception Occured !";
            ArrayList vQueryList      = new ArrayList();

            objRFProcessing.TableName_TBL = PMS_RFProcessing_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objRFProcessing.RFProcessCode_PK))
                {
                    objRFProcessing.RFProcessCode_PK = Guid.NewGuid().ToString();
                    objRFProcessing.RFProcessId      = _iIDGenCriteriaInfo.GenerateID(trans, objRFProcessing, EnumIdCategory.RFPProcessing);
                }
                vQueryList.Add(GetQuery(objRFProcessing));

                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(30, objRFProcessing.RFProcessCode_PK, objRFProcessing.UserCode, objRFProcessing.CompanyCode_FK, connection, trans);
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "RFP Saved Successfully";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
Beispiel #2
0
        public string SaveSupplier(SupplierInfo objsupplierInfo)
        {
            int       vResult         = 0;
            int       vApprovalResult = 0;
            string    vOut            = "Exception Occured !";
            ArrayList vQueryList      = new ArrayList();

            objsupplierInfo.TableName_TBL = SupplierInfo_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objsupplierInfo.SupplierCode_PK))
                {
                    objsupplierInfo.SupplierCode_PK = Guid.NewGuid().ToString();
                    objsupplierInfo.SupplierID      = _iIDGenCriteriaInfo.GenerateID(trans, objsupplierInfo, EnumIdCategory.SupplierID);
                }
                vQueryList.Add(GetQuery(objsupplierInfo));
                foreach (SupplierContact supplierContact in objsupplierInfo.SupplierContactList_VW)
                {
                    if (string.IsNullOrEmpty(supplierContact.ContactPersonCode_PK))
                    {
                        supplierContact.ContactPersonCode_PK = Guid.NewGuid().ToString();
                        supplierContact.TableName_TBL        = SupplierContact_TBL;
                        supplierContact.SupplierCode_FK      = objsupplierInfo.SupplierCode_PK;
                    }
                    vQueryList.Add(GetQuery(supplierContact));
                }
                foreach (SupplierAttachment supplierAttachment in objsupplierInfo.SupplierAttachmentList_VW)
                {
                    if (string.IsNullOrEmpty(supplierAttachment.AttachmentCode_PK))
                    {
                        supplierAttachment.AttachmentCode_PK = Guid.NewGuid().ToString();
                        supplierAttachment.TableName_TBL     = SupplierAttachment_TBL;
                        supplierAttachment.SupplierCode_FK   = objsupplierInfo.SupplierCode_PK;
                    }
                    vQueryList.Add(GetQuery(supplierAttachment));
                }
                foreach (SupplierBusiness supplierBusiness in objsupplierInfo.SupplierBusinessList_VW)
                {
                    if (supplierBusiness.BusinessTypeCode_PK != 0)
                    {
                        supplierBusiness.TableName_TBL   = SupplierBusiness_TBL;
                        supplierBusiness.SupplierCode_FK = objsupplierInfo.SupplierCode_PK;
                    }
                    vQueryList.Add(GetQuery(supplierBusiness));
                }

                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(27, objsupplierInfo.SupplierCode_PK, objsupplierInfo.UserCode, objsupplierInfo.CompanyCode_FK, connection, trans);
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "Supplier Information Saved Successfully";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public string SavePurchaseRequsition(PurchaseRequisition objPMS_PurchaseRequisition)
        {
            int       vResult         = 0;
            int       vApprovalResult = 0;
            string    vOut            = "Exception Occured !";
            ArrayList vQueryList      = new ArrayList();

            objPMS_PurchaseRequisition.TableName_TBL = PMS_PurchaseRequisition_TBL;
            SqlConnection connection = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                if (string.IsNullOrEmpty(objPMS_PurchaseRequisition.RequisitionCode_PK))
                {
                    objPMS_PurchaseRequisition.RequisitionCode_PK = Guid.NewGuid().ToString();
                    objPMS_PurchaseRequisition.RequisitionID      = _iIDGenCriteriaInfo.GenerateID(trans, objPMS_PurchaseRequisition, EnumIdCategory.PurchaseRequsition);
                }
                vQueryList.Add(GetQuery(objPMS_PurchaseRequisition));
                foreach (PurchaseRequisitionItem objPurchaseRequisitionItem in objPMS_PurchaseRequisition.PurchaseRequisitionItemList_VW)
                {
                    if (string.IsNullOrEmpty(objPurchaseRequisitionItem.RequisitionDetCode_PK))
                    {
                        objPurchaseRequisitionItem.RequisitionDetCode_PK = Guid.NewGuid().ToString();
                        objPurchaseRequisitionItem.TableName_TBL         = PMS_PurchaseRequisitionItem_TBL;
                        objPurchaseRequisitionItem.RequisitionCode       = objPMS_PurchaseRequisition.RequisitionCode_PK;
                    }
                    vQueryList.Add(GetQuery(objPurchaseRequisitionItem));
                    foreach (PurchaseReqItemSpecification objPurchaseReqItemSpecification in objPurchaseRequisitionItem.PurchaseReqItemSpecificationList_VW)
                    {
                        if (string.IsNullOrEmpty(objPurchaseReqItemSpecification.SpecificationCode_PK))
                        {
                            objPurchaseReqItemSpecification.SpecificationCode_PK = Guid.NewGuid().ToString();
                            objPurchaseReqItemSpecification.TableName_TBL        = PMS_PurchaseReqItemSpecification_TBL;
                            objPurchaseReqItemSpecification.RequisitionDetCode   = objPurchaseRequisitionItem.RequisitionDetCode_PK;
                        }
                        vQueryList.Add(GetQuery(objPurchaseReqItemSpecification));
                    }
                }
                foreach (PurchaseRequisitionCondition objPurchaseRequisitionTerms in objPMS_PurchaseRequisition.PurchaseRequisitionTermsList_VW)
                {
                    if (!string.IsNullOrEmpty(objPurchaseRequisitionTerms.ConditionCode_PK))
                    {
                        //objPurchaseRequisitionTerms.ConditionCode_PK = Guid.NewGuid().ToString();
                        objPurchaseRequisitionTerms.TableName_TBL   = PMS_RequisitionTermsCondition_TBL;
                        objPurchaseRequisitionTerms.RequisitionCode = objPMS_PurchaseRequisition.RequisitionCode_PK;
                    }
                    vQueryList.Add(GetQuery(objPurchaseRequisitionTerms));
                }
                try
                {
                    using (SqlCommand command = _supplierDbContext.GetCommand())
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(29, objPMS_PurchaseRequisition.RequisitionCode_PK, objPMS_PurchaseRequisition.UserCode, objPMS_PurchaseRequisition.CompanyCode_FK, connection, trans);
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "Purchase Requsition Saved Successfully";
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }
        public string SaveUploadedFiles(List <UploadedFile> objUploadedFileList)
        {
            int           vResult         = 0;
            int           vApprovalResult = 0;
            string        vOut            = "Exception Occured !";
            ArrayList     vQueryList      = new ArrayList();
            SqlConnection connection      = _supplierDbContext.GetConn();

            connection.Open();
            using (SqlTransaction trans = connection.BeginTransaction())
            {
                foreach (UploadedFile objUploadedFile in objUploadedFileList)
                {
                    if (string.IsNullOrEmpty(objUploadedFile.UploadedCode_PK))
                    {
                        objUploadedFile.TableName_TBL   = UploadedFilesInfo_TBL;
                        objUploadedFile.UploadedCode_PK = Guid.NewGuid().ToString();
                    }
                    vQueryList.Add(GetQuery(objUploadedFile));
                }


                try
                {
                    using (SqlCommand command = new SqlCommand("", connection, trans))
                    {
                        foreach (string obj_temp in vQueryList)
                        {
                            command.CommandText = obj_temp;
                            vResult             = command.ExecuteNonQuery();
                        }
                    }
                    if (vResult > 0)
                    {
                        foreach (UploadedFile objUploadedFile in objUploadedFileList)
                        {
                            vApprovalResult = AppObjectInfoMapDC.GenerateApprovalFromOtherObject(28, objUploadedFile.UploadedCode_PK, objUploadedFile.UserCode, objUploadedFile.CompanyCode_FK, connection, trans);
                            if (vApprovalResult == 0)
                            {
                                break;
                            }
                        }
                        if (vApprovalResult > 0)
                        {
                            trans.Commit();
                            vOut = "Supplier Document Uploaded Successfully";
                        }
                        else
                        {
                            trans.Rollback();
                        }
                    }
                }
                catch (DbException ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(vOut);
        }