Example #1
0
 public void SaveVendor_AccountView(Vendor_AccountView argVendor_AccountView, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsVendor_AccountViewExists(argVendor_AccountView.VendorCode, argVendor_AccountView.PurchaseOrgCode, argVendor_AccountView.CompanyCode, argVendor_AccountView.ClientCode, da) == false)
         {
             InsertVendor_AccountView(argVendor_AccountView, da, lstErr);
         }
         else
         {
             UpdateVendor_AccountView(argVendor_AccountView, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         objErrorHandler.Type       = ErrorConstant.strAboartType;
         objErrorHandler.MsgId      = 0;
         objErrorHandler.Module     = ErrorConstant.strInsertModule;
         objErrorHandler.ModulePart = ErrorConstant.strDetailModule;
         objErrorHandler.Message    = ex.Message.ToString();
         objErrorHandler.RowNo      = 0;
         objErrorHandler.FieldName  = "";
         objErrorHandler.LogCode    = "";
         lstErr.Add(objErrorHandler);
     }
 }
Example #2
0
        private Vendor_AccountView objCreateVendor_AccountView(DataRow dr)
        {
            Vendor_AccountView tVendor_AccountView = new Vendor_AccountView();

            tVendor_AccountView.SetObjectInfo(dr);

            return(tVendor_AccountView);
        }
Example #3
0
        public Vendor_AccountView objGetVendor_AccountView(string argVendorCode, string argPurchaseOrgCode, string argCompanyCode, string argClientCode)
        {
            Vendor_AccountView argVendor_AccountView = new Vendor_AccountView();
            DataSet            DataSetToFill         = new DataSet();

            if (argVendorCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argPurchaseOrgCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argCompanyCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argClientCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetVendor_AccountView(argVendorCode, argPurchaseOrgCode, argCompanyCode, argClientCode);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argVendor_AccountView = this.objCreateVendor_AccountView((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argVendor_AccountView);
        }
Example #4
0
        public void InsertVendor_AccountView(Vendor_AccountView argVendor_AccountView, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[11];
            param[0] = new SqlParameter("@VendorCode", argVendor_AccountView.VendorCode);
            param[1] = new SqlParameter("@PurchaseOrgCode", argVendor_AccountView.PurchaseOrgCode);
            param[2] = new SqlParameter("@CompanyCode", argVendor_AccountView.CompanyCode);
            param[3] = new SqlParameter("@ReconsilationAccount", argVendor_AccountView.ReconsilationAccount);
            param[4] = new SqlParameter("@PaymentTermsCode", argVendor_AccountView.PaymentTermsCode);
            param[5] = new SqlParameter("@ClientCode", argVendor_AccountView.ClientCode);
            param[6] = new SqlParameter("@CreatedBy", argVendor_AccountView.CreatedBy);
            param[7] = new SqlParameter("@ModifiedBy", argVendor_AccountView.ModifiedBy);

            param[8]           = new SqlParameter("@Type", SqlDbType.Char);
            param[8].Size      = 1;
            param[8].Direction = ParameterDirection.Output;

            param[9]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[9].Size      = 255;
            param[9].Direction = ParameterDirection.Output;

            param[10]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[10].Size      = 20;
            param[10].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_InsertVendor_AccountView", param);


            string strMessage  = Convert.ToString(param[9].Value);
            string strType     = Convert.ToString(param[8].Value);
            string strRetValue = Convert.ToString(param[10].Value);


            objErrorHandler.Type        = strType;
            objErrorHandler.MsgId       = 0;
            objErrorHandler.Module      = ErrorConstant.strInsertModule;
            objErrorHandler.ModulePart  = ErrorConstant.strMasterModule;
            objErrorHandler.Message     = strMessage.ToString();
            objErrorHandler.RowNo       = 0;
            objErrorHandler.FieldName   = "";
            objErrorHandler.LogCode     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);
        }
Example #5
0
        public ICollection <Vendor_AccountView> colGetVendor_AccountView(string argVendorCode, string argClientCode)
        {
            List <Vendor_AccountView> lst          = new List <Vendor_AccountView>();
            DataSet            DataSetToFill       = new DataSet();
            Vendor_AccountView tVendor_AccountView = new Vendor_AccountView();

            DataSetToFill = this.GetVendor_AccountView(argVendorCode, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateVendor_AccountView(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveVendor_PurchaseOrg(Vendor_PurchaseOrg argVendor_PurchaseOrg, Vendor_AccountView argVendor_AccountView, ICollection <Vendor_AccViewWHTax> colGetVendor_AccViewWHTax)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                da.Open_Connection();
                da.BEGIN_TRANSACTION();

                if (blnIsVendor_PurchaseOrgExists(argVendor_PurchaseOrg.VendorCode, argVendor_PurchaseOrg.PurchaseOrgCode, argVendor_PurchaseOrg.CompanyCode, argVendor_PurchaseOrg.ClientCode, da) == false)
                {
                    InsertVendor_PurchaseOrg(argVendor_PurchaseOrg, da, lstErr);
                }
                else
                {
                    UpdateVendor_PurchaseOrg(argVendor_PurchaseOrg, da, lstErr);
                }

                foreach (ErrorHandler objerr in lstErr)
                {
                    if (objerr.Type == "E")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }

                    if (objerr.Type == "A")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }
                }

// For Account View
                objVendor_AccountViewManager.SaveVendor_AccountView(argVendor_AccountView, da, lstErr);

                foreach (ErrorHandler objerr in lstErr)
                {
                    if (objerr.Type == "E")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }

                    if (objerr.Type == "A")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }
                }

// For Account_ViewWH Tax
                if (colGetVendor_AccViewWHTax.Count > 0)
                {
                    foreach (Vendor_AccViewWHTax argVendor_AccViewWHTax in colGetVendor_AccViewWHTax)
                    {
                        if (argVendor_AccViewWHTax.IsDeleted == 0)
                        {
                            objVendor_AccViewWHTaxManager.SaveVendor_AccViewWHTax(argVendor_AccViewWHTax, da, lstErr);
                        }
                        else
                        {
                            objVendor_AccViewWHTaxManager.DeleteVendor_AccViewWHTax(argVendor_AccViewWHTax.VendorCode, argVendor_AccViewWHTax.PurchaseOrgCode, argVendor_AccViewWHTax.CompanyCode, argVendor_AccViewWHTax.ClientCode, argVendor_AccViewWHTax.IsDeleted);
                        }
                    }

                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                        if (objerr.Type == "A")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
                da.COMMIT_TRANSACTION();
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }
Example #7
0
        public ICollection <ErrorHandler> SaveVendor_AccountView(Vendor_AccountView argVendor_AccountView)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsVendor_AccountViewExists(argVendor_AccountView.VendorCode, argVendor_AccountView.PurchaseOrgCode, argVendor_AccountView.CompanyCode, argVendor_AccountView.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertVendor_AccountView(argVendor_AccountView, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateVendor_AccountView(argVendor_AccountView, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }