Exemplo n.º 1
0
        public CompanyAddress Create(CompanyAddress companyAddress)
        {
            ECompanyAddress eCompanyAddress = ECompanyAddress(companyAddress);

            eCompanyAddress = _iDCompanyAddress.Create(eCompanyAddress);
            return(CompanyAddress(eCompanyAddress));
        }
 public CompanyAddress Visit(CompanyAddress address)
 {
     address.Line1           = new StringFixVisitor().Visit(address.Line1);
     address.Line2           = new StringFixVisitor().Visit(address.Line2);
     address.AdditionalLines = new StringListFixVisitor().Visit(address.AdditionalLines);
     return(address);
 }
Exemplo n.º 3
0
        public ActionResult SaveAddress(CompanyAddress address, int userId)
        {
            var res       = CompanyAddress.Insert(address, userId);
            int addressId = -1;

            if (res.Success)
            {
                addressId = Convert.ToInt32(res.MessageError);
                res       = Company.SetDefaultAddress(address.Company.Id, addressId, userId);
                if (res.Success)
                {
                    res = ActivityLog.Company(address.Company.Id, userId, address.Company.Id, CompanyLogActions.NewCompanyAddress, string.Empty);
                    if (res.Success)
                    {
                        res.MessageError   = addressId.ToString();
                        Session["Company"] = new Company(address.Company.Id);
                    }
                }
            }

            if (res.Success)
            {
                var companySession = new Company(address.Company.Id);
                HttpContext.Current.Session["Company"] = companySession;
            }

            return(res);
        }
        /// <summary>
        /// 获取收货供应商日期数据
        /// </summary>
        /// <param name="request">前端请求参数</param>
        /// <returns>数据</returns>
        public static List <PurchaseReceiptSupplierDate> GetReceiptSupplierDate(PurchaseRequest request)
        {
            try
            {
                CompanyAddress company = Common.CompanyHelper.GetCompanyAddress(request.companyGuid);
                if (company == null)
                {
                    throw new Exception("Aden.BLL.Common.CompanyHelper.GetCompanyAddress doesn't exist companyGuid:" + request.companyGuid);
                }
                //获取当前公司账期信息
                DateTime  eDate = DateTime.Now;
                DateRange range = Common.CompanyHelper.GetMonthlyJournalDateRange(company.erpCode, company.ip, "41", eDate);
                if (range == null)
                {
                    throw new Exception("Journal Closed.dbCode:" + company.erpCode);
                }
                List <PurchaseReceiptSupplierDate> data = factory.GetReceiptSupplierDate(company.erpCode, company.ip,
                                                                                         request.langCode, request.warehouseCode, ((DateTime)range.startDate).ToString("yyyy-MM-dd"),
                                                                                         ((DateTime)range.endDate).ToString("yyyy-MM-dd"));

                return(data);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(new Log()
                {
                    message = ex.Message
                }, "GetReceiptSupplierDate");
                return(null);
            }
        }
Exemplo n.º 5
0
        public Response Custom(string token, [FromBody] CompanyAddress compAddr)
        {
            Response response = new Response();

            if (string.IsNullOrEmpty(token) || !token.Equals(_token))
            {
                response.code    = "404";
                response.message = "Invild token";
            }
            else
            {
                var data = MastDataHelper.GetCustom(compAddr);
                if (data == null)
                {
                    response.code    = "500";
                    response.message = "No Data";
                }
                else
                {
                    response.code    = "200";
                    response.content = data;
                }
            }
            return(response);
        }
        /// <summary>
        /// 获取采购订单数据
        /// </summary>
        /// <param name="request">前端传递的请求参数</param>
        /// <returns>采购单数据</returns>
        public static PurchaseOrderData GetPurchaseOrderData(PurchaseRequest request)
        {
            try
            {
                CompanyAddress company = Common.CompanyHelper.GetCompanyAddress(request.companyGuid);

                if (company == null)
                {
                    throw new Exception("Aden.BLL.Common.CompanyHelper.GetCompanyAddress doesn't exist companyGuid:" + request.companyGuid);
                }
                List <PurchaseOrderLine> lines = factory.GetPurchaseOrderData(company.erpCode, company.ip,
                                                                              DateTime.Parse(request.orderDate).ToString("yyyy-MM-dd"), request.warehouseCode,
                                                                              request.costCenterCode, request.supplierCode, request.langCode);
                return(new PurchaseOrderData()
                {
                    lines = lines
                });
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(new Log()
                {
                    message = ex.Message
                }, "GetPurchaseOrderData");
                return(null);
            }
        }
 /// <summary>
 /// 保存采购收货
 /// </summary>
 /// <param name="data">前端采购收货数据</param>
 /// <returns>处理状态响应</returns>
 public static bool SavePurchaseReceipt(PurchaseReceiptData data)
 {
     try
     {
         if (data.lines == null || data.lines.Count == 0)
         {
             return(false);
         }
         CompanyAddress company = Common.CompanyHelper.GetCompanyAddress(data.companyGuid);
         if (company == null)
         {
             throw new Exception("Aden.BLL.Common.CompanyHelper.GetCompanyAddress doesn't exist companyGuid:" + data.companyGuid);
         }
         string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
         return(factory.AddPurchaseReceipt(data.lines, company.erpCode, data.receiptDate, data.warehouseCode, data.supplierCode, data.poType,
                                           data.userGuid, now));
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(new Log()
         {
             message = ex.Message
         }, "SavePurchaseReceipt");
         return(true);
     }
 }
 /// <summary>
 /// 根据PurchaseRequest获取供应商列表
 /// </summary>
 /// <param name="companyGuid">公司Guid</param>
 /// <param name="langCode">语言代码</param>
 /// <param name="orderDate">订单日期</param>
 /// <param name="warehouseCode">仓库代码</param>
 /// <returns>供应商列表</returns>
 public static List <Supplier> GetSupplierList(string companyGuid, string langCode, string orderDate, string warehouseCode, string costCenterCode, string type)
 {
     try
     {
         CompanyAddress company = Common.CompanyHelper.GetCompanyAddress(companyGuid);
         if (company == null)
         {
             throw new Exception("Aden.BLL.Common.CompanyHelper.GetCompanyAddress doesn't exist companyGuid:" + companyGuid);
         }
         if (type == "pricelist")
         {
             return(factory.GetSupplierListFromPriceList(company.erpCode, company.ip, langCode, DateTime.Parse(orderDate).ToString("yyyy-MM-dd"), warehouseCode));
         }
         if (type == "order")
         {
             return(factory.GetSupplierListFromOrder(company.erpCode, company.ip, langCode, DateTime.Parse(orderDate).ToString("yyyy-MM-dd"), warehouseCode, costCenterCode));
         }
         return(null);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(new Log()
         {
             message = ex.Message
         }, "getSuppliersData");
         return(null);
     }
 }
        /// <summary>
        /// 根据供应商获取该供应商的产品信息
        /// </summary>
        /// <param name="companyGuid">公司Guid</param>
        /// <param name="date">订单日期</param>
        /// <param name="warehouseCode">仓库代码</param>
        /// <param name="langCode">语言代码</param>
        /// <param name="supplierCode">供应商代码</param>
        /// <returns>供应商的产品信息列表</returns>
        public static List <PurchaseItem> GetItemListFromPriceList(string companyGuid, string date, string warehouseCode, string langCode, string supplierCode)
        {
            try
            {
                CompanyAddress cmpAddress = Aden.BLL.Common.CompanyHelper.GetCompanyAddress(companyGuid);

                if (cmpAddress == null)
                {
                    throw new Exception("Aden.BLL.Common.CompanyHelper.GetCompanyAddress doesn't exist companyGuid:" + companyGuid);
                }

                return(factory.GetItemListFromPriceList(cmpAddress.erpCode, cmpAddress.ip, date, warehouseCode, langCode, new List <string>()
                {
                    supplierCode
                }));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(new Log()
                {
                    message = ex.Message
                }, "GetPriceItemByPurchase");
                return(null);
            }
        }
Exemplo n.º 10
0
        public async Task <CompanyAddress> Update(int id, CompanyAddress input)
        {
            CompanyAddress companyAddress = _context.CompaniesAddresses.Find(id);

            if (companyAddress != null)
            {
                companyAddress.StreetName        = input.StreetName;
                companyAddress.HouseNumber       = input.HouseNumber;
                companyAddress.City              = input.City;
                companyAddress.PostalCode        = input.PostalCode;
                companyAddress.Latitude          = input.Latitude;
                companyAddress.Longtitude        = input.Longtitude;
                companyAddress.Headquarter       = input.Headquarter;
                companyAddress.CompanyId         = input.CompanyId;
                companyAddress.UserId            = input.UserId;
                companyAddress.FreeForInspection = input.FreeForInspection;
                await _context.SaveChangesAsync();

                return(companyAddress);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 11
0
        public virtual ActionResult SetCustomShipping(long orderId,
                                                      IList <CustomShippingItemViewModel> items)
        {
            LogI("SetCustomShipping, orderId=" + orderId + ", items=" + String.Join(", ", items.Select(i => i.ToString()).ToList()));

            var rateProviders = ServiceFactory.GetShipmentProviders(LogService,
                                                                    Time,
                                                                    DbFactory,
                                                                    WeightService,
                                                                    AccessManager.Company.ShipmentProviderInfoList,
                                                                    null,
                                                                    null,
                                                                    null,
                                                                    null);

            var result = CustomShippingItemViewModel.Apply(Db,
                                                           LogService,
                                                           Time,
                                                           WeightService,
                                                           orderId,
                                                           rateProviders,
                                                           CompanyAddress.GetReturnAddress(MarketIdentifier.Empty()),
                                                           CompanyAddress.GetPickupAddress(MarketIdentifier.Empty()),
                                                           items,
                                                           AccessManager.IsFulfilment);

            if (result.IsSuccess)
            {
                return(JsonGet(ValueResult <IList <SelectListShippingOption> > .Success("", result.Data)));
            }
            return(JsonGet(ValueResult <IList <SelectListShippingOption> > .Error(result.Message)));
        }
Exemplo n.º 12
0
        public ActionResult UpdateAddress(CompanyAddress oldAddress, CompanyAddress newAddress, int userId)
        {
            var    res       = ActionResult.NoAction;
            string extradata = CompanyAddress.Differences(oldAddress, newAddress);

            if (!string.IsNullOrEmpty(extradata))
            {
                res = newAddress.Update(userId);
                if (res.Success)
                {
                    res = ActivityLog.Company(newAddress.Company.Id, userId, newAddress.Company.Id, CompanyLogActions.Update, extradata);
                }
            }
            else
            {
                res.SetSuccess();
            }

            if (res.Success)
            {
                var companySession = new Company(newAddress.Company.Id);
                HttpContext.Current.Session["Company"] = companySession;
            }

            return(res);
        }
 /// <summary>
 /// 获取采购收货数据
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public static PurchaseReceiptData GetPurchaseReceiptData(PurchaseRequest request)
 {
     try
     {
         CompanyAddress company = Common.CompanyHelper.GetCompanyAddress(request.companyGuid);
         if (company == null)
         {
             throw new Exception("Aden.BLL.Common.CompanyHelper.GetCompanyAddress doesn't exist companyGuid:" + request.companyGuid);
         }
         List <PurchaseReceiptLine> lines = factory.GetPurchaseReceiptData(company.erpCode, company.ip, request.orderDate,
                                                                           request.poType, request.supplierCode, request.warehouseCode, request.langCode);
         if (lines == null || lines.Count == 0)
         {
             return(null);
         }
         var query = lines.GroupBy(l => l.itemCode).Where(g => g.Select(r => r.price).Distinct().Count() > 1);
         if (query.Any())
         {
             throw new Exception("Exist different price in the same supplier.dbCode:" + company.erpCode
                                 + ";supplierCode:" + request.supplierCode + ";warehouseCode:" + request.warehouseCode + ";date:" + request.orderDate);
         }
         return(new PurchaseReceiptData()
         {
             lines = lines
         });
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(new Log()
         {
             message = ex.Message
         }, "GetReceiptData");
         return(null);
     }
 }
 public void FillOutCertaintyApprovalAuto(string customerPostCode, string day, string month, string year, string directorAnswer)
 {
     CompanyAddress.EnterAutoAddress(customerPostCode);
     EnterDOB.FillDOB(day, month, year);
     DirectorOfCompany.SelectDirectorCompany(directorAnswer);
     _seeCertainty.Click();
 }
 public void FillOutCertaintyApproval(string customerAddress1, string customerCity, string customerPostcode, string day, string month, string year)
 {
     _bizAddress.SendText(Keys.Tab);
     CompanyAddress.EnterManualAddress(customerAddress1, customerCity, customerPostcode);
     EnterDOB.FillDOB(day, month, year);
     dobField.SendKeys(Keys.Enter);
 }
Exemplo n.º 16
0
        /// <summary>
        /// This function creates Company in the database on the basis of details provided by the user
        /// </summary>
        /// <param name="CompanyAddressDTOobject"></param>
        /// <returns></returns>
        public Boolean CreateCompany(CompanyAddressDTO CompanyAddressDTOobject)
        {
            bool flag = false;

            try
            {
                using (UnitOfWork uow = new UnitOfWork())
                {
                    CompanyAddress companyaddressObj = new CompanyAddress();
                    Company        companyObj        = new Company();
                    Address        addressObj        = new Address();

                    companyObj.Company1         = CompanyAddressDTOobject.Company.Company1;
                    companyObj.CompanyCode      = GenerateCompanyCode(uow.StateRepo.GetById(Convert.ToInt64(CompanyAddressDTOobject.Address.FkStateId)).StateCode, CompanyAddressDTOobject.Company.Company1, CompanyAddressDTOobject.Address.City);
                    companyObj.Active           = true;
                    companyObj.RecordStatus     = 1;
                    companyObj.CreatedBy        = 123;
                    companyObj.CreatedDate      = DateTime.Now.Date;
                    companyObj.LastModifiedDate = DateTime.Now.Date;
                    companyObj.LastModifiedBy   = DateTime.Now;
                    uow.CompanyRepo.Add(companyObj);
                    uow.Complete();

                    addressObj.AddressType      = 1;
                    addressObj.Address1         = CompanyAddressDTOobject.Address.Address1;
                    addressObj.Address2         = CompanyAddressDTOobject.Address.Address2;
                    addressObj.City             = CompanyAddressDTOobject.Address.City;
                    addressObj.FkStateId        = CompanyAddressDTOobject.Address.FkStateId;
                    addressObj.CreatedBy        = 123;
                    addressObj.CreatedDate      = DateTime.Now.Date;
                    addressObj.LastModifiedDate = DateTime.Now.Date;
                    addressObj.LastModifiedBy   = DateTime.Now;

                    uow.AddressRepo.Add(addressObj);
                    uow.Complete();


                    var CompanyId = uow.CompanyRepo.GetAll().Where(a => a.Company1 == CompanyAddressDTOobject.Company.Company1).FirstOrDefault().CompanyId;
                    var AddressId = uow.AddressRepo.GetAll().Where(a => a.Address1 == CompanyAddressDTOobject.Address.Address1 &&
                                                                   a.Address2 == CompanyAddressDTOobject.Address.Address2 &&
                                                                   a.City == CompanyAddressDTOobject.Address.City &&
                                                                   a.FkStateId == CompanyAddressDTOobject.Address.FkStateId).FirstOrDefault().AddressId;

                    companyaddressObj.FkCompanyId = CompanyId;
                    companyaddressObj.FkAddressId = AddressId;
                    companyaddressObj.CreatedBy   = 123;
                    companyaddressObj.CreatedDate = DateTime.Now.Date;

                    uow.CompanyAddressRepo.Add(companyaddressObj);
                    uow.Complete();
                    flag = true;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
            return(flag);
        }
Exemplo n.º 17
0
        public void insertAddress()
        {
            Console.WriteLine("---주소 입력---");
            Console.WriteLine("1.일반   2.대학   3.회사");
            Console.Write("번호 선택 >> ");
            int     sel = Int32.Parse(Console.ReadLine());
            string  name, phone, addr;
            string  major, year;
            string  company, job;
            Address address;

            Console.Write("이름 입력 >> ");
            name = Console.ReadLine();
            Console.Write("전화 입력 >> ");
            phone = Console.ReadLine();
            Console.Write("주소 입력 >> ");
            addr = Console.ReadLine();
            if (sel == 1)
            {
                address       = new Address();
                address.Name  = name;
                address.Phone = phone;
                address.Addr  = addr;

                arrList.Add(address);
            }
            else if (sel == 2)
            {
                Console.Write("전공 입력 >> ");
                major = Console.ReadLine();
                Console.Write("학년 입력 >> ");
                year = Console.ReadLine();

                address = new UnivAddress();
                ((UnivAddress)address).Name  = name;
                ((UnivAddress)address).Phone = phone;
                ((UnivAddress)address).Addr  = addr;
                ((UnivAddress)address).Major = major;
                ((UnivAddress)address).Year  = year;

                arrList.Add(address);
            }
            else if (sel == 3)
            {
                Console.Write("회사 입력 >> ");
                company = Console.ReadLine();
                Console.Write("업무 입력 >> ");
                job = Console.ReadLine();

                address = new CompanyAddress();
                ((CompanyAddress)address).Name    = name;
                ((CompanyAddress)address).Phone   = phone;
                ((CompanyAddress)address).Addr    = addr;
                ((CompanyAddress)address).Company = company;
                ((CompanyAddress)address).Job     = job;

                arrList.Add(address);
            }
        }
        public ActionResult DeleteConfirmed(Guid id)
        {
            CompanyAddress companyAddress = db.CompanyAddresses.Find(id);

            db.CompanyAddresses.Remove(companyAddress);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void FillOutCertaintyApprovalAuto(string customerPostCode, string day, string month, string year, string industryType, string creditAmount, string cardProvider)
 {
     CompanyAddress.EnterAutoAddress(customerPostCode);
     EnterDOB.FillDOB(day, month, year);
     YourIndustry.SelectDirectorCompany(industryType);
     CardTerminal.SetCreditAmount(creditAmount, cardProvider);
     _seeCertainty.Click();
 }
 public void FillOutCertaintyApproval(string customerAddress1, string customerCity, string customerPostcode, string day, string month, string year, string directorAnswer)
 {
     _bizAddress.SendText(Keys.Tab);
     CompanyAddress.EnterManualAddress(customerAddress1, customerCity, customerPostcode);
     EnterDOB.FillDOB(day, month, year);
     DirectorOfCompany.SelectDirectorCompany(directorAnswer);
     _seeCertainty.Click();
 }
Exemplo n.º 21
0
        public Guid CreateCompanyAddress(CompanyAddress address)
        {
            address.Id = _fakeObjectGenerator.GetNewGuid();

            _fakeObjectGenerator.CompanyAddresses.Add(address);

            return(address.Id);
        }
Exemplo n.º 22
0
 public void AddCompanyAdress(CompanyAddress companyaddress)
 {
     using (var dbcontext = new EntityContext())
     {
         dbcontext.CompanyAddresses.Add(companyaddress);
         dbcontext.SaveChanges();
     }
 }
 public IActionResult PostCompanyAddress([FromBody] CompanyAddress companyAddresses)
 {
     if (companyAddresses == null)
     {
         return(BadRequest("CompanyAddress is null!!!!!"));
     }
     _repository.Add(companyAddresses);
     return(CreatedAtRoute("GetCompanyAddresses", new { Id = companyAddresses.CompanyAddressID }, companyAddresses));
 }
 public void FillOutCertaintyApproval(string customerAddress1, string customerCity, string customerPostcode, string day, string month, string year, string industryType, string creditAmount, string cardProvider)
 {
     _bizAddress.SendText(Keys.Tab);
     CompanyAddress.EnterManualAddress(customerAddress1, customerCity, customerPostcode);
     EnterDOB.FillDOB(day, month, year);
     YourIndustry.SelectDirectorCompany(industryType);
     CardTerminal.SetCreditAmount(creditAmount, cardProvider);
     _seeCertainty.Click();
 }
Exemplo n.º 25
0
        /// <summary>
        /// 取得税主数据
        /// </summary>
        /// <returns></returns>
        public List <Tax> GetTax(CompanyAddress compAddr)
        {
            string strSql = " SELECT REPLACE(BTWTRANS, ' ', '') AS TAXCODE " +
                            " , CAST(BTWPER AS NVARCHAR(50)) AS TAXVALUE " +
                            " , ISNULL(OMS30_0, OMS30_1) AS TAXNAME " +
                            " FROM BTWTRS order by BTWPER ";

            return(SqlServerHelper.GetEntityList <Tax>(string.Format(SqlServerHelper.customerConn(), compAddr.ip, compAddr.erpCode), strSql.ToString()));
        }
Exemplo n.º 26
0
        /// <summary>
        /// 取得付款方式主数据
        /// </summary>
        /// <returns></returns>
        public List <Payment> GetPayment(CompanyAddress compAddr)
        {
            string strSql = " SELECT BETCOND AS PAYMENTCODE " +
                            " , OMS30_0 AS PAYMENTNAME_EN " +
                            " , OMS30_1 AS PAYMENTNAME_ZH " +
                            " FROM BETCD ";

            return(SqlServerHelper.GetEntityList <Payment>(string.Format(SqlServerHelper.customerConn(), compAddr.ip, compAddr.erpCode), strSql.ToString()));
        }
Exemplo n.º 27
0
 public static AddressModel ToAddressModel(this CompanyAddress entity)
 {
     return(new AddressModel
     {
         Id = entity.Id,
         Address = entity.Address,
         PostalCode = entity.PostalCode,
         Country = entity.Country
     });
 }
 public void FillOutYourBusinessPage(string legalEntity, string companyPostcode, int howLongVal, string setAnnualTurnover, string fundingPurpose, string businessCustomers)
 {
     LegalEntity.SetLegalEntity(legalEntity);
     CompanyAddress.EnterAutoAddress(companyPostcode);
     HowLongTrading.SetTradingTime(howLongVal);
     NeedForFinance.SelectFundingPurpose(fundingPurpose);
     AnnualTurnover.setAnnualTurnover(setAnnualTurnover);
     BusinessCustomers.SetBusinessCustomer(businessCustomers);
     _continueButton.Click();
 }
        public IActionResult GetCompanyAddressById(long companyAddressesId)
        {
            CompanyAddress companyAddresses = _repository.Get(companyAddressesId);

            if (companyAddresses == null)
            {
                return(NotFound("CompanyAddress record Not Found !!!"));
            }
            return(Ok(companyAddresses));
        }
Exemplo n.º 30
0
        /// <summary>
        /// 取得币别主数据
        /// </summary>
        /// <returns></returns>
        public List <Currency> GetCurr(CompanyAddress compAddr)
        {
            string strSql = " SELECT VALCODE AS CURRCODE " +
                            " , OMS30_0 AS CURRNAME_EN " +
                            " , OMS30_1 AS CURRNAME_ZH " +
                            " FROM VALUTA " +
                            " WHERE ACTIVE = 1 ";

            return(SqlServerHelper.GetEntityList <Currency>(string.Format(SqlServerHelper.customerConn(), compAddr.ip, compAddr.erpCode), strSql.ToString()));
        }