Example #1
0
        public string AddVendor(string UserCode, string PlainPassword,
                                string StrAccID, int AccYear, string Act, EntityVendor entity, out int success)
        {
            success = 0;
            #region 验证

            // 字段必填项验证
            string msg = "";
            if (!entity.CheckEntity(out msg))
            {
                return(msg);
            }


            if (!string.IsNullOrWhiteSpace(GetVendorName(entity.cVenCode)))
            {
                return(string.Format("U8中已存在供应商编码:{0}!", entity.cVenCode));
            }

            if (string.IsNullOrWhiteSpace(GetcVcCode(entity.cVcCode)))
            {
                return(string.Format("U8中不存在供应商分类编码:{0}!", entity.cVcCode));
            }

            #endregion
            entity.cMaker = GetUserName(UserCode);
            string id = InsertVendor(entity);
            success = string.IsNullOrWhiteSpace(id) ? 0 : 1;;
            return(id);
        }
Example #2
0
 public VendorInfo(EntityVendor vendor, ImmutableList <EntityVendorCategory> categories, ImmutableList <EntityVendorItem> items)
 {
     Id = vendor.Id;
     SellPriceMultiplier = vendor.SellPriceMultiplier;
     BuyPriceMultiplier  = vendor.BuyPriceMultiplier;
     Categories          = categories;
     Items = items;
 }
Example #3
0
 internal static Vendor Map(EntityVendor entity)
 {
     return(new Vendor
     {
         VendorId = entity.VendorId,
         Name = entity.Name
     });
 }
Example #4
0
 public int AddVendor(Vendor vendor)
 {
     using (var context = DataObjectFactory.CreateContext())
     {
         var entity = new EntityVendor {
             Name = vendor.Name
         };
         context.Vendors.Add(entity);
         context.SaveChanges();
         return(entity.VendorId);
     }
 }
Example #5
0
File: Form1.cs Project: Core130/jr
        private void bt_Vendor_Click(object sender, EventArgs e)
        {
            EntityVendor doc = new EntityVendor();

            doc.cVenCode    = "SZ0075";
            doc.cVenName    = "测试";
            doc.cVenAbbName = "测试";
            doc.cVcCode     = "01";
            string entity = JsonConvert.SerializeObject(doc);

            string postUrl = string.Format(@"{0}={1}&ModelType=8009", addpara, entity);
            string result  = SendHttpRequest(addurl, postUrl, "POST");

            textBox1.Text = result;
        }
Example #6
0
        public string InsertVendor(EntityVendor vendor)
        {
            if (vendor == null)
            {
                throw new JRException("供应商新增失败!没有数据!");
            }
            string sql = string.Format(@"
INSERT INTO  Vendor  ( cVenCode , cVenName , cVenAbbName , cVCCode , cDCCode , cTrade , cVenAddress , cVenPostCode , cVenRegCode ,
cVenBank , cVenAccount , dVenDevDate , cVenLPerson , cVenPhone , cVenFax , cVenEmail , cVenPerson , cVenBP , cVenHand , cVenPPerson ,
iVenDisRate , iVenCreGrade , iVenCreLine , iVenCreDate , cVenPayCond , cVenIAddress , cVenIType , cVenHeadCode , cVenWhCode , 
cVenDepart , iAPMoney , dLastDate , iLastMoney , dLRDate , iLRMoney , dEndDate , iFrequency , bVenTax , cVenDefine1 , cVenDefine2 , 
cVenDefine3 , cCreatePerson , cModifyPerson , dModifyDate , cRelCustomer , cBarCode , cVenDefine4 , cVenDefine5 , cVenDefine6 , 
cVenDefine7 , cVenDefine8 , cVenDefine9 , cVenDefine10 , cVenDefine11 , cVenDefine12 , cVenDefine13 , cVenDefine14 , cVenDefine15 , 
cVenDefine16 , fRegistFund , iEmployeeNum , iGradeABC , cMemo , dLicenceSDate , dLicenceEDate , iLicenceADays , dBusinessSDate , 
dBusinessEDate , iBusinessADays , dProxySDate , dProxyEDate , iProxyADays , bVenCargo , bProxyForeign , bVenService , cVenTradeCCode , 
cVenBankCode , cVenExch_name , iVenGSPType , iVenGSPAuth , cVenGSPAuthNo , cVenBusinessNo , cVenLicenceNo , bVenOverseas , 
bVenAccPeriodMng , cVenPUOMProtocol , cVenOtherProtocol , cVenCountryCode , cVenEnName , cVenEnAddr1 , cVenEnAddr2 , cVenEnAddr3 , 
cVenEnAddr4 , cVenPortCode , cVenPrimaryVen , fVenCommisionRate , fVenInsueRate , bVenHomeBranch , cVenBranchAddr , cVenBranchPhone , 
cVenBranchPerson , cVenSSCode , cOMWhCode , cVenCMProtocol , cVenIMProtocol , iVenTaxRate , dVenCreateDatetime , cVenMnemCode ) 
VALUES (@cVenCode,@cVenName,@cVenAbbName,@cVCCode,NULL,NULL,NULL,NULL,NULL,NULL,NULL,GETDATE(),NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,0,NULL,0,0,NULL,NULL,NULL,@cVenCode,NULL,NULL,0,NULL,0,NULL,0,NULL,0,1,NULL,NULL,NULL,@cCreatePerson,@cModifyPerson,GETDATE(),NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,0,
NULL,NULL,N'人民币',0,-1,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,GETDATE(),NULL)
");

            SqlParameter[] para =
            {
                new SqlParameter("@cVenCode",      vendor.cVenCode),
                new SqlParameter("@cVenName",      vendor.cVenName),
                new SqlParameter("@cVenAbbName",   vendor.cVenAbbName),
                new SqlParameter("@cVCCode",       vendor.cVcCode),
                new SqlParameter("@cCreatePerson", vendor.cMaker),
                new SqlParameter("@cModifyPerson", vendor.cMaker),
            };

            int headCount = this.DB_SqlHelper.ExecuteNonQuery(sql, para);

            return(vendor.cVenCode);
        }
Example #7
0
        public string AddModels(string UserCode, string CipherPassword, int ModelType,
                                string StrAccID, string Act, string Entity)
        {
            //Entity = System.Web.HttpUtility.UrlDecode(Entity);
            string plainPassword = DefineEncryptDecrypt.Decrypt(CipherPassword);
            int    AccYear       = U8BllBase.GetBeginYear(StrAccID);

            if (AccYear == 0)
            {
                return(ControllerHelp.GetReturnStr(0, string.Format("没有找到账套号:{0}", StrAccID)));
            }
            int        success = 0;
            ModelsType mt      = (ModelsType)ModelType;

            switch (mt)
            {
            case ModelsType.Sale:     // 销售订单
                lock (SaleLock)
                {
                    if (Act == "add")
                    {
                        EntitySaleHead entity = JsonConvert.DeserializeObject <EntitySaleHead>(Entity);
                        SoMainBll      bll    = new SoMainBll(StrAccID, AccYear, UserCode, plainPassword);
                        var            result = bll.AddSale(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord09:     // 配送出库单(其他出库单)
                lock (RdRecord09Lock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord09Head entity = JsonConvert.DeserializeObject <EntityRdRecord09Head>(Entity);
                        RdRecord09Bll        bll    = new RdRecord09Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord09(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.DispatchList1:    //销售退货单
            case ModelsType.DispatchList4:    //委托代销退货单
                lock (DispatchList1Lock)
                {
                    if (Act == "add")
                    {
                        EntityDispatchListHead entity = JsonConvert.DeserializeObject <EntityDispatchListHead>(Entity);
                        DispatchListBll        bll    = new DispatchListBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddDispatchList(UserCode, plainPassword, StrAccID, AccYear, Act, ModelsType.DispatchList1 == mt ? 0 : 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.DispatchList2:    //销售发货单
            case ModelsType.DispatchList3:    //委托代销发货单
                lock (DispatchList2Lock)
                {
                    if (Act == "add")
                    {
                        EntityDispatchListHead entity = JsonConvert.DeserializeObject <EntityDispatchListHead>(Entity);
                        DispatchListBll        bll    = new DispatchListBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddDispatchList(UserCode, plainPassword, ModelType, StrAccID, AccYear, Act, ModelsType.DispatchList2 == mt ? 0 : 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Ap_CloseBill:    //收款单
                lock (Ap_CloseBillLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_CloseBillHead entity = JsonConvert.DeserializeObject <EntityAp_CloseBillHead>(Entity);
                        Ap_CloseBillBll        bll    = new Ap_CloseBillBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_CloseBill(UserCode, plainPassword, StrAccID, AccYear, Act, ModelType, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Ap_Vouch:    //其他应付款
                lock (Ap_VouchLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_VouchHead entity = JsonConvert.DeserializeObject <EntityAp_VouchHead>(Entity);
                        Ap_VouchBll        bll    = new Ap_VouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_Vouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.PO_Pomain:    //采购订单
                lock (PO_PomainLock)
                {
                    if (Act == "add")
                    {
                        EntityPO_Pomain entity = JsonConvert.DeserializeObject <EntityPO_Pomain>(Entity);
                        PO_PomainBll    bll    = new PO_PomainBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddPO_Pomain(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord01:    //采购入库单
                lock (RdRecord01Lock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord01Head entity = JsonConvert.DeserializeObject <EntityRdRecord01Head>(Entity);
                        RdRecord01Bll        bll    = new RdRecord01Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord01(UserCode, plainPassword, StrAccID, AccYear, Act, 0, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.PayAp_CloseBill:     //付款单
                lock (PayAp_CloseBillLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_CloseBillHead entity = JsonConvert.DeserializeObject <EntityAp_CloseBillHead>(Entity);
                        Ap_CloseBillBll        bll    = new Ap_CloseBillBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_CloseBill(UserCode, plainPassword, StrAccID, AccYear, Act, ModelType, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.ST_AppTransVouch:     //调拨申请单
                lock (ST_AppTransVouchLock)
                {
                    if (Act == "add")
                    {
                        EntityST_AppTransVouch entity = JsonConvert.DeserializeObject <EntityST_AppTransVouch>(Entity);
                        ST_AppTransVouchBll    bll    = new ST_AppTransVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddST_AppTransVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.TransVouch:     //调拨单
                lock (TransVouchLock)
                {
                    if (Act == "add")
                    {
                        EntityTransVouch entity = JsonConvert.DeserializeObject <EntityTransVouch>(Entity);
                        TransVouchBll    bll    = new TransVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddTransVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Vendor:     //供应商
                lock (VendorLock)
                {
                    if (Act == "add")
                    {
                        EntityVendor entity = JsonConvert.DeserializeObject <EntityVendor>(Entity);
                        VendorBll    bll    = new VendorBll(StrAccID, AccYear, UserCode, plainPassword);
                        var          result = bll.AddVendor(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.CheckVouch:     //盘点单
                lock (VendorLock)
                {
                    if (Act == "add")
                    {
                        EntityCheckVouchHead entity = JsonConvert.DeserializeObject <EntityCheckVouchHead>(Entity);
                        CheckVouchBll        bll    = new CheckVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddCheckVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.InventoryClass:     //存货分类
                lock (InventoryClassLock)
                {
                    if (Act == "add")
                    {
                        EntityInventoryClass entity = JsonConvert.DeserializeObject <EntityInventoryClass>(Entity);
                        InventoryClassBll    bll    = new InventoryClassBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddInventoryClass(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Inventory:     //存货档案
                lock (InventoryLock)
                {
                    if (Act == "add")
                    {
                        EntityInventory entity = JsonConvert.DeserializeObject <EntityInventory>(Entity);
                        InventoryBll    bll    = new InventoryBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddInventory(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.WareHouse:     //仓库档案
                lock (WareHouseLock)
                {
                    if (Act == "add")
                    {
                        EntityWareHouse entity = JsonConvert.DeserializeObject <EntityWareHouse>(Entity);
                        WareHouseBll    bll    = new WareHouseBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddWareHouse(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Customer:     //客户档案
                lock (CustomerLock)
                {
                    if (Act == "add")
                    {
                        EntityCustomer entity = JsonConvert.DeserializeObject <EntityCustomer>(Entity);
                        CustomerBll    bll    = new CustomerBll(StrAccID, AccYear, UserCode, plainPassword);
                        var            result = bll.AddCustomer(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord01T:    //红字采购入库单
                lock (RdRecord01TLock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord01Head entity = JsonConvert.DeserializeObject <EntityRdRecord01Head>(Entity);
                        RdRecord01Bll        bll    = new RdRecord01Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord01(UserCode, plainPassword, StrAccID, AccYear, Act, 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }
            }

            return(ControllerHelp.GetReturnStr(0, "AddModels中没有找到可对应的操作项"));
        }