/// <summary>
    /// this method show a customerFollowup
    /// </summary>
    private void ShowCustomerFollowup()
    {

        customerManager = new CustomerManager(this);
        var customerFollowup = customerManager.GetCustomerFollowup(Company.CompanyId, Convert.ToInt32(Page.ViewState["CustomerFollowupId"]));

        txtContactId.Value = customerFollowup.ContactId.ToString();

        var taskManager = new TaskManager(this);
        var task = taskManager.GetTask(customerFollowup.CustomerFollowupId, "CustomerFollowUp.aspx");

        if (task != null)
        {
            ucNextMeetingDate.DateTime = task.StartDate;
            txtAppoitmentSubject.Text = task.Name;
        }

        selContact.ShowContact(customerFollowup.Contact);

        if (customerFollowup.CustomerFollowupActionId.HasValue)
            cboCustomerFollowupAction.SelectedValue = customerFollowup.CustomerFollowupActionId.ToString();

        txtEntryDate.Text = "Data de Entrada:<br/><b>" + customerFollowup.EntryDate.ToString("dd/MM/yyyy") + "</b>";
        txtDescription.Text = customerFollowup.Description;

        Page.ViewState["CustomerId"] = customerFollowup.CustomerId;
        Page.ViewState["ContactId"] = customerFollowup.ContactId;

    }
Exemplo n.º 2
0
        public void fillData(DataGridViewRow row)
        {
            try
            {
                textBoxMaPhieu.Text = row.Cells[0].Value.ToString();
                textBoxNgayTao.Text = row.Cells[1].Value.ToString();
                textBoxNguoiLapPhieu.Text = row.Cells[3].Value.ToString();

                HoTro ht = new HoTro();
                ht.TaiDuLieu(comboBoxKh, "Customer", "CustomerId", "CustomerName");
                string CusName = row.Cells[2].Value.ToString();
                CustomerManager pl = new CustomerManager();
                foreach (Customer p in pl.GetAll())
                {
                    if (p.CustomerName.Equals(CusName))
                    {
                        comboBoxKh.SelectedValue = p.ID;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        public FrmCustomer()
        {
            InitializeComponent();

            //
            customerManager = new CustomerManager();
            countryManager = new CountryManager();
        }
    public static void DeleteCustomerFollowup(int customerFollowupId)
    {
        using (CustomerManager customerManager = new CustomerManager(null))
        {
            var taskManager = new TaskManager(null);
            var task = taskManager.GetTask(customerFollowupId, "CustomerFollowUp.aspx");

            if (task != null)
                taskManager.DeleteTask(task);

            customerManager.DeleteCustomerFollowup(customerManager.GetCustomerFollowup(customerFollowupId));
        }
    }
    protected void txtCustomer_TextChanged(object sender, EventArgs e)
    {
        ProfileManager profileManager;
        //select the customer
        if (txtCustomer.Text.Contains("|"))
        {
            OnSelectingCustomer(this, new SelectingCustomerEventArgs() { CustomerName = txtCustomer.Text });

            customerManager = new CustomerManager(this);
            profileManager = new ProfileManager(this);

            string[] identifications = txtCustomer.Text.Split('|');
            string identification = identifications[0].ToString().Trim();

            customer = customerManager.GetCustomer(Page.Company.CompanyId, identification);

            ShowCustomer(customer);
            txtCustomer.Text = "";
        }

    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Initialize variables
        prospectComments.HomePath = Company.GetFilesDirectory();

        saleManager = new SaleManager(this);
        customerManager = new CustomerManager(this);

        if (!IsPostBack)
        {
            BudgetItemList = null;

            if (!String.IsNullOrEmpty(Request["BudgetId"]))
                BudgetId = Convert.ToInt32(Request["BudgetId"]);

            cboVendor.DataSource = new HumanResourcesManager(this).GetSalesPerson(Company.CompanyId);
            cboVendor.DataBind();

            if (BudgetId != 0)
                ShowBudget(BudgetId);
        }
    }
Exemplo n.º 7
0
        public RMASendAccessoryInfo BuildfromSO(int soSysNo)
        {
            RMASendAccessoryInfo rmaInfo = new RMASendAccessoryInfo();
            SOInfo soInfo = SaleManager.GetInstance().LoadSO(soSysNo);

            if (soInfo != null && soInfo.Status == (int)AppEnum.SOStatus.OutStock)
            {
                rmaInfo.SOSysNo       = soInfo.SysNo;
                rmaInfo.CustomerSysNo = soInfo.CustomerSysNo;
                CustomerInfo oCustomer = CustomerManager.GetInstance().Load(soInfo.CustomerSysNo);
                rmaInfo.Address    = soInfo.ReceiveAddress != AppConst.StringNull ? soInfo.ReceiveAddress : (oCustomer.ReceiveAddress != AppConst.StringNull ? oCustomer.ReceiveAddress : (oCustomer.DwellAddress != AppConst.StringNull ? oCustomer.DwellAddress : "无"));
                rmaInfo.Contact    = soInfo.ReceiveContact != AppConst.StringNull ? soInfo.ReceiveContact : (oCustomer.ReceiveContact != AppConst.StringNull ? oCustomer.ReceiveContact : (oCustomer.CustomerName != AppConst.StringNull ? oCustomer.CustomerName : "无"));
                rmaInfo.CreateTime = DateTime.Now;
                if (soInfo.ReceivePhone != AppConst.StringNull)
                {
                    rmaInfo.Phone = soInfo.ReceivePhone;
                }
                if (soInfo.ReceiveCellPhone != AppConst.StringNull)
                {
                    rmaInfo.Phone += "  " + soInfo.ReceiveCellPhone;
                }
                rmaInfo.AreaSysNo = soInfo.ReceiveAreaSysNo;
                if (soInfo.ItemHash.Count > 0)
                {
                    int j = 0;
                    foreach (SOItemInfo soItem in soInfo.ItemHash.Values)
                    {
                        if (soItem.ProductType == (int)AppEnum.SOItemType.Promotion)
                        {
                            continue;  //这里排除优惠券。
                        }
                        if (soItem.Quantity > 0)
                        {
                            Hashtable htTemp = new Hashtable(1);
                            htTemp.Add("SOItemSysNo", soItem.SysNo.ToString());
                            DataSet dsTemp = SaleManager.GetInstance().GetSOProductIDSysNoList(htTemp);

                            int rowCount = 0;
                            if (Util.HasMoreRow(dsTemp))
                            {
                                rowCount = dsTemp.Tables[0].Rows.Count;
                            }

                            for (int i = 1; i <= soItem.Quantity; i++)
                            {
                                RMASendAccessoryItemInfo rmaItem = new RMASendAccessoryItemInfo();
                                rmaItem.ProductSysNo      = soItem.ProductSysNo;
                                rmaItem.AccessoryType     =
                                    rmaItem.AccessoryType = (int)AppEnum.RMAAccessoryType.Accessory;

                                if (i <= rowCount)
                                {
                                    int POSysNo        = Util.TrimIntNull(dsTemp.Tables[0].Rows[i - 1]["posysno"].ToString());
                                    int ProductIDSysNo = Util.TrimIntNull(dsTemp.Tables[0].Rows[i - 1]["ProductIDSysNo"]);
                                    if (POSysNo > 0)
                                    {
                                        rmaItem.SOItemPODesc = "采购单号:<a href=\"javascript:openWindowS2('../Purchase/POSheet.aspx?sysno=" + POSysNo + "&opt=view')" + "\" >" + POSysNo + "</a><br>";
                                    }
                                    else if (ProductIDSysNo > 0)
                                    {
                                        rmaItem.SOItemPODesc = "商品序列号:<a href=\"javascript:openWindowS2('../Basic/ProductID.aspx?sysno=" + ProductIDSysNo + "')" + "\" >" + ProductIDSysNo + "</a><br>";
                                    }
                                    rmaItem.ProductIDSysNo = ProductIDSysNo;
                                    rmaItem.AccessoryType  = (int)AppEnum.RMAAccessoryType.Accessory;
                                }
                                rmaInfo.ItemHash.Add(j, rmaItem);
                                j = j + 1;
                            }
                        }
                    }
                }
            }
            else
            {
                rmaInfo = null;
            }
            return(rmaInfo);
        }
Exemplo n.º 8
0
        public static List <StoreTransfer> MapStoreTransferData(DataTable dTstore)
        {
            List <StoreTransfer> ListStores = new List <StoreTransfer>();

            foreach (DataRow dr in dTstore.Rows)
            {
                StoreTransfer mapData = new StoreTransfer();
                mapData.Id       = int.Parse(dr["id"].ToString());
                mapData.InOut    = (StoreMovementType)Enum.Parse(typeof(StoreMovementType), dr["Type"].ToString());
                mapData.Status   = (StoreTransferStatus)Enum.Parse(typeof(StoreTransferStatus), dr["Status"].ToString());
                mapData.Customer = dr["CustomerId"] != null?CustomerManager.GetCustomerRef(dr["CustomerId"].ToString()) : CustomerManager.GetDefaultRef();

                mapData.CreatedOn = dr["CreatedOn"] != DBNull.Value ? DateTime.Parse(dr["CreatedOn"].ToString()) : DateTime.MinValue;
                mapData.CreatedBy = dr["CreatedBy"] != null?UserManager.GetUserRef(dr["CreatedBy"].ToString()) : UserManager.GetDefaultRef();

                mapData.ModifiedOn = dr["ModifiedOn"] != DBNull.Value ? DateTime.Parse(dr["ModifiedOn"].ToString()) : DateTime.MinValue;
                mapData.ModifiedBy = dr["ModifiedBy"] != null?UserManager.GetUserRef(dr["ModifiedBy"].ToString()) : UserManager.GetDefaultRef();

                mapData.CompletedOn = dr["CompletedOn"] != DBNull.Value ? DateTime.Parse(dr["CompletedOn"].ToString()) : DateTime.MinValue;
                mapData.LeadId      = dr["LeadId"] != null?UserManager.GetUserRef(dr["LeadId"].ToString()) : UserManager.GetDefaultRef();

                mapData.STNumber = dr["SMNumber"] != null ? dr["SMNumber"].ToString() : "";
                mapData.STDate   = dr["SMDate"] != DBNull.Value ? DateTime.Parse(dr["SMDate"].ToString()) : DateTime.MinValue;

                mapData.Origin = dr["Origin"] != null?CommonDataManager.GetOrigin(dr["Origin"].ToString()) : CommonDataManager.GetDefaultRef();

                mapData.Size = dr["Size"] != null?CommonDataManager.GetSize(dr["Size"].ToString()) : CommonDataManager.GetDefaultRef();

                mapData.Vessel = dr["Vessel"] != null?CommonDataManager.GetVessel(dr["Vessel"].ToString()) : CommonDataManager.GetDefaultRef();

                mapData.Quantity = dr["Quantity"] != null?decimal.Parse(dr["Quantity"].ToString()) : 0;

                mapData.FromStoreId = dr["FromStoreId"] != null?StoreManager.GetStoreRef(dr["FromStoreId"].ToString()) : StoreManager.GetDefaultRef();

                mapData.ToStoreId = dr["ToStoreId"] != null?StoreManager.GetStoreRef(dr["ToStoreId"].ToString()) : StoreManager.GetDefaultRef();

                mapData.VehicleNo   = dr["VehicleNo"] != null ? dr["VehicleNo"].ToString() : "";
                mapData.BiltyNo     = dr["BiltyNo"] != null ? dr["BiltyNo"].ToString() : "";
                mapData.BiltyDate   = dr["BiltyDate"] != DBNull.Value ? DateTime.Parse(dr["BiltyDate"].ToString()) : DateTime.MinValue;
                mapData.RRInvoice   = dr["RRInvoice"] != null ? dr["RRInvoice"].ToString() : "";
                mapData.CCMNumber   = dr["CCMNumber"] != null ? dr["CCMNumber"].ToString() : "";
                mapData.Transporter = dr["Transporter"] != null?CommonDataManager.GetTrader(dr["Transporter"].ToString()) : CommonDataManager.GetDefaultRef();

                mapData.StoreInDate     = dr["StoreInDate"] != DBNull.Value ? DateTime.Parse(dr["StoreInDate"].ToString()) : DateTime.MinValue;
                mapData.StoreInQuantity = dr["StoreInQuantity"] != null?decimal.Parse(dr["StoreInQuantity"].ToString()) : 0;

                ListStores.Add(mapData);
                mapData = null;
            }
            return(ListStores);
        }
Exemplo n.º 9
0
 public void SetupForEachTest()
 {
     _mockCustomerRepository = new Mock <ICustomerRepository>();
     _customerManager        = new CustomerManager(_mockCustomerRepository.Object);
 }
Exemplo n.º 10
0
 public List <Customer> getAllCustomers()
 {
     return(CustomerManager.getInstance().getAllCustomers());
 }
Exemplo n.º 11
0
    protected void SelCustomer_SelectedCustomer(object sender, SelectedCustomerEventArgs e)
    {
        if (e.Customer != null)
        {
            CustomerManager customerManager = new CustomerManager(this);
            Session["CustomerId"] = e.Customer.CustomerId;
            lstBudget.DataSourceID = "odsBudgets";
            lstBudget.DataBind();

            lblBudget.Visible = helpToolTipBudget.Visible = lstBudget.Items.Count > 0;
        }

    }
Exemplo n.º 12
0
    /// <summary>
    /// load data of customer for report
    /// </summary>
    public void loadDataOfCustomer()
    {

        if (budget != null)
        {
            CustomerManager customerManager = new CustomerManager(this);
            SelCustomer.ShowCustomer(customerManager.GetCustomer(budget.CustomerId.Value, (int)Company.MatrixId));

        }
    }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            //CarManager carManager = new CarManager(new EfCarDal());

            //GETALL
            //foreach (var c0 in carManager.GetAll().Data)
            //{
            //    Console.WriteLine(c0.Id + " " + c0.BrandId + " " + c0.ColorId + " " + c0.ModelYear + " " + c0.DailyPrice + " " + c0.Description);

            //}

            ////GETBYBRANDID
            //foreach (var c in carManager.GetCarsByBrandId(2).Data)
            //{
            //    Console.WriteLine(c.Id + " " + c.BrandId + " " + c.ColorId + " " + c.ModelYear + " " + c.DailyPrice + " " + c.Description);
            //}

            ////GETBYCOLORID
            //foreach (var c1 in carManager.GetCarsByColorId(3).Data)
            //{
            //    Console.WriteLine(c1.Id + " " + c1.BrandId + " " + c1.ColorId + " " + c1.ModelYear + " " + c1.DailyPrice + " " + c1.Description);
            //}

            ////GETBYCARID
            //var car = carManager.GetByCarId(11).Data;
            //Console.WriteLine(car.ModelYear);

            //Car car1 = new Car
            //{
            //    Id = 13,
            //    BrandId = 6,
            //    ColorId = 2,
            //    ModelYear=1989,
            //    DailyPrice=250,
            //    Description= "Benzinli ve manual",
            //    CarName = "Mustang"
            //};

            //Car car2 = new Car
            //{
            //    Id = 13,
            //    BrandId = 6,
            //    ColorId = 3,
            //    ModelYear = 1993,
            //    DailyPrice = 370,
            //    Description = "Benzinli ve manual",
            //    CarName = "Fiesta"
            //};

            ////ADD
            //carManager.Add(car1);
            //var carAdded = carManager.GetByCarId(13).Data;
            //Console.WriteLine(carAdded.Id + " " + carAdded.ModelYear + " " + carAdded.ColorId);


            ////UPDATE
            //carManager.Update(car2);
            //var carUpdated = carManager.GetByCarId(12).Data;
            //Console.WriteLine(carUpdated.Id + " " + carUpdated.ModelYear + " " + carUpdated.ColorId);

            ////DELETE
            //carManager.Delete(car2);

            ////GETALL
            //foreach (var car3 in carManager.GetAll().Data)
            //{
            //    Console.WriteLine(car3.Id + " " + car3.BrandId + " " + car3.ColorId + " " + car3.ModelYear + " " + car3.DailyPrice + " " + car3.Description);
            //}

            //GETCARDETAILS-DTO

            //var result = carManager.GetCarDetails();

            //if (result.Success==true)
            //{
            //    foreach (var carDetail in result.Data)
            //    {
            //        Console.WriteLine
            //            (
            //            "car name : " + carDetail.CarName + " * " +
            //            "brand name : " + carDetail.BrandName + " * " +
            //            "color name : " + carDetail.ColorName + " * " +
            //            "daily price : " + carDetail.DailyPrice
            //            );
            //    }
            //    Console.WriteLine(result.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result.Message);
            //}


            //ColorManager colorManager = new ColorManager(new EfColorDal());

            //var result = colorManager.GetAll();

            //if (result.Success == true)
            //{
            //    foreach (var colorDetail in result.Data)
            //    {
            //        Console.WriteLine
            //            (
            //            "color name : " + colorDetail.ColorName + " * " +
            //            "color id : " + colorDetail.ColorId + " * "

            //            );
            //    }
            //    Console.WriteLine(result.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result.Message);
            //}

            //BrandManager brandManager = new BrandManager(new EfBrandDal());

            //var result = brandManager.GetAll();

            //if (result.Success == true)
            //{
            //    foreach (var brandDetail in result.Data)
            //    {
            //        Console.WriteLine
            //            (
            //            "brand name : " + brandDetail.BrandName + " * " +
            //            "brand id : " + brandDetail.BrandId + " * "

            //            );
            //    }
            //    Console.WriteLine(result.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result.Message);
            //}

            //var result1 = brandManager.GetByBrandId(5);

            //if (result1.Success == true)
            //{

            //        Console.WriteLine
            //            (
            //            "brand name : " + result1.Data.BrandName + " * " +
            //            "brand id : " + result1.Data.BrandId

            //            );

            //    Console.WriteLine(result1.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result1.Message);
            //}

            //UserManager userManager = new UserManager(new EfUserDal());

            //var result = userManager.GetAll();

            //if (result.Success == true)
            //{
            //    foreach (var user in result.Data)
            //    {


            //          Console.WriteLine("user id = " + user.UserId + " / " +
            //                  "firstname = " + user.FirstName + " / " +
            //                  "lastname = " + user.LastName + " / " +
            //                  "email = " + user.Email + " / " +
            //                  "passworrd = " + user.Password);


            //    }
            //    Console.WriteLine(result.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result.Message);
            //}


            //User user1 = new User
            //{
            //    UserId = 1,
            //    FirstName = "İsmet",
            //    LastName = "Kara",
            //    Email = "*****@*****.**",
            //    Password="******"
            //};

            //User user2 = new User
            //{
            //    UserId = 2,
            //    FirstName = "Ece",
            //    LastName = "Çakır",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //};
            //User user3 = new User
            //{
            //    UserId = 3,
            //    FirstName = "Rasim",
            //    LastName = "Helva",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //};
            //User user4 = new User
            //{
            //    UserId = 4,
            //    FirstName = "Seçkin",
            //    LastName = "Tutuk",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //};
            //User user5 = new User
            //{
            //    UserId = 5,
            //    FirstName = "Banu",
            //    LastName = "Mavi",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //};
            //User user6 = new User
            //{
            //    UserId = 5,
            //    FirstName = "Banu",
            //    LastName = "Mavi",
            //    Email = "*****@*****.**",
            //    Password = "******"
            //};

            //**İLK 5 KULLANICIYI EKLE, 6. KULLANICIYI GÜNCELLEME İÇİN KULLAN , 1. KULLANICIYI SİL
            //userManager.Add(user1);
            //Console.WriteLine("user id = " + user1.UserId + " / " +
            //                  "firstname = " + user1.FirstName + " / " +
            //                  "lastname = " + user1.LastName + " / " +
            //                  "email = " + user1.Email + " / " +
            //                  "passworrd = " + user1.Password          );
            //userManager.Add(user2);
            //Console.WriteLine("user id = " + user2.UserId + " / " +
            //                  "firstname = " + user2.FirstName + " / " +
            //                  "lastname = " + user2.LastName + " / " +
            //                  "email = " + user2.Email + " / " +
            //                  "passworrd = " + user2.Password);
            //userManager.Add(user3);
            //Console.WriteLine("user id = " + user3.UserId + " / " +
            //                  "firstname = " + user3.FirstName + " / " +
            //                  "lastname = " + user3.LastName + " / " +
            //                  "email = " + user3.Email + " / " +
            //                  "passworrd = " + user3.Password);
            //userManager.Add(user4);
            //Console.WriteLine("user id = " + user4.UserId + " / " +
            //                  "firstname = " + user4.FirstName + " / " +
            //                  "lastname = " + user4.LastName + " / " +
            //                  "email = " + user4.Email + " / " +
            //                  "passworrd = " + user4.Password);
            //userManager.Add(user5);
            //Console.WriteLine("user id = " + user5.UserId + " / " +
            //                  "firstname = " + user5.FirstName + " / " +
            //                  "lastname = " + user5.LastName + " / " +
            //                  "email = " + user5.Email + " / " +
            //                  "passworrd = " + user5.Password);

            //userManager.Update(user6);
            //userManager.Delete(user1);

            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            //var result = customerManager.GetAll();

            //if (result.Success == true)
            //{
            //    foreach (var customer in result.Data)
            //    {


            //        Console.WriteLine("customer id = " + customer.CustomerId + " / " +
            //                          "user id = " + customer.UserId + " / " +
            //                          "company name = " + customer.CompanyName);


            //    }
            //    Console.WriteLine(result.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result.Message);
            //}


            Customer customer1 = new Customer
            {
                CustomerId  = 1,
                UserId      = 3,
                CompanyName = "Rasim Makina"
            };
            Customer customer2 = new Customer
            {
                CustomerId  = 2,
                UserId      = 5,
                CompanyName = "Mavi Reklamcılık"
            };
            Customer customer3 = new Customer
            {
                CustomerId  = 3,
                UserId      = 2,
                CompanyName = "Çakır Holding"
            };
            Customer customer4 = new Customer
            {
                CustomerId  = 4,
                UserId      = 4,
                CompanyName = "Yılmaz Pastanesi"
            };
            Customer customer5 = new Customer
            {
                CustomerId  = 3,
                UserId      = 2,
                CompanyName = "Yılmaz Pastanesi"
            };

            //ilk 4 customer eklenecek, 5. müşteri bilgileri update için kullanılacak ve customer4 silinecek

            //customerManager.Add(customer1);
            //Console.WriteLine("customer id = " + customer1.CustomerId + " / " +
            //                  "user id = " + customer1.UserId + " / " +
            //                  "company name = " + customer1.CompanyName );

            //customerManager.Add(customer2);
            //Console.WriteLine("customer id = " + customer2.CustomerId + " / " +
            //                  "user id = " + customer2.UserId + " / " +
            //                  "company name = " + customer2.CompanyName);

            //customerManager.Add(customer3);
            //Console.WriteLine("customer id = " + customer3.CustomerId + " / " +
            //                  "user id = " + customer3.UserId + " / " +
            //                  "company name = " + customer3.CompanyName);

            //customerManager.Add(customer4);
            //Console.WriteLine("customer id = " + customer4.CustomerId + " / " +
            //                  "user id = " + customer4.UserId + " / " +
            //                  "company name = " + customer4.CompanyName);

            //customerManager.Update(customer5);
            //customerManager.Delete(customer4);

            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            //var result = rentalManager.GetAll();

            //if (result.Success == true)
            //{
            //    foreach (var rental in result.Data)
            //    {

            //        Console.WriteLine("rental id = " + rental.RentalId + " / " +
            //                          "car id = " + rental.CarId + " / " +
            //                          "customer id = " + rental.CustomerId + " / " +
            //                          "rent date = " + rental.RentDate + " / " +
            //                          "return date = " + rental.ReturnDate);


            //    }
            //    Console.WriteLine(result.Message);

            //}
            //else
            //{
            //    Console.WriteLine(result.Message);
            //}

            Rental rental1 = new Rental
            {
                RentalId   = 1,
                CarId      = 1,
                CustomerId = 2,
                RentDate   = new DateTime(2020, 02, 08),
                ReturnDate = new DateTime(2020, 02, 10)
            };

            Rental rental2 = new Rental
            {
                RentalId   = 2,
                CarId      = 7,
                CustomerId = 3,
                RentDate   = new DateTime(2019, 04, 15),
                ReturnDate = new DateTime(2019, 05, 25)
            };

            Rental rental3 = new Rental
            {
                RentalId   = 3,
                CarId      = 9,
                CustomerId = 1,
                RentDate   = new DateTime(2021, 01, 01),
                ReturnDate = new DateTime(2021, 01, 30)
            };

            Rental rental4 = new Rental
            {
                RentalId   = 3,
                CarId      = 3,
                CustomerId = 1,
                RentDate   = new DateTime(2021, 01, 01),
                ReturnDate = new DateTime(2021, 01, 30)
            };

            Rental rental5 = new Rental
            {
                RentalId   = 5,
                CarId      = 4,
                CustomerId = 1,
                RentDate   = new DateTime(2021, 01, 01),
                ReturnDate = null
            };

            //ilk üç rental ı ekle, rental4 ile rental3 ün carid bilgisini güncelle,rental2 yi sil
            //rentalManager.Add(rental1);
            //Console.WriteLine("rental id = " + rental1.RentalId + " / " +
            //                  "car id = " + rental1.CarId + " / " +
            //                  "customer id = " + rental1.CustomerId + " / " +
            //                  "rent date = " + rental1.RentDate + " / " +
            //                  "return date = " + rental1.ReturnDate );

            //rentalManager.Add(rental2);
            //Console.WriteLine("rental id = " + rental2.RentalId + " / " +
            //                  "car id = " + rental2.CarId + " / " +
            //                  "customer id = " + rental2.CustomerId + " / " +
            //                  "rent date = " + rental2.RentDate + " / " +
            //                  "return date = " + rental2.ReturnDate);

            //rentalManager.Add(rental3);
            //Console.WriteLine("rental id = " + rental3.RentalId + " / " +
            //                  "car id = " + rental3.CarId + " / " +
            //                  "customer id = " + rental3.CustomerId + " / " +
            //                  "rent date = " + rental3.RentDate + " / " +
            //                  "return date = " + rental3.ReturnDate);

            //rentalManager.Update(rental4);

            //rentalManager.Delete(rental2);

            //return date null ilse araba kiralanamaz
            //rentalManager.Add(rental5);
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            CustomerManager customermanager = new CustomerManager(new EfCustomerDal());
            UserManager     usermanager     = new UserManager(new EfUserDal());
            User            user            = new User {
                Email = "*****@*****.**", FirstName = "Dzhan", LastName = "Halim", Password = "******"
            };

            usermanager.Add(user);
            Customer customer = new Customer {
                Id = 1, CompanyName = "Odisee"
            };

            Rental rental = new Rental {
                CarId = 1, CustomerId = 1, RentDate = DateTime.Today, ReturnDate = DateTime.Today.AddDays(5)
            };



            CarManager carManager = new CarManager(new EfCarDal());
            Car        car        = new Car {
                BrandId = 1, ColorId = 2, Description = "Mercedes-Benz", ModelYear = 2000, Price = 150
            };
            Car car2 = new Car {
                BrandId = 2, ColorId = 3, Description = "Volvo D40", ModelYear = 2000, Price = 150
            };
            Car car3 = new Car {
                BrandId = 3, ColorId = 1, Description = "Audi A3", ModelYear = 2000, Price = 200
            };

            Car carToUpdate = new Car {
                BrandId = 3, ColorId = 3, Description = "Mercedes2", Id = 5, ModelYear = 2000, Price = 200
            };

            // operation add a new car


            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            // carManager.GetAllBydId(5);
            // carManager.GetCarsByBrandId(3);
            // carManager.GetCarsByColorId(3);

            // operation update
            //carManager.Update(carToUpdate);

            var result2 = rentalManager.GetAllRentals();

            if (result2.Success)
            {
                foreach (var item in result2.Data)
                {
                    Console.WriteLine(item.CarId + " " + item.CustomerId + " " + item.RentDate);
                }
            }
            else
            {
                Console.WriteLine(result2.Message);
            }


            // operation get all cars
            var result = carManager.GetCarDetails();

            if (result.Success)
            {
                foreach (var item in result.Data)
                {
                    //carManager.Delete(item);
                    Console.WriteLine(item.Description + item.BrandName + " / " + item.ColorName + " / " + item.Price);
                }
                Console.WriteLine(result.Message);
            }
            else
            {
                Console.WriteLine(result.Message);
            }
            // operation get a car by his id
            //foreach (var item in carManager.GetAllBydId(5))
            //{
            //    //carManager.Delete(item);
            //    Console.WriteLine(item.Description + " / " );
            //}

            // deleteing operation
            //carManager.Delete(car2);

            Console.ReadLine();
        }
 public CustomersController(CustomerManager repo)
 {
     _repo = repo;
 }
Exemplo n.º 16
0
 public CustomerController()
 {
     _customerManager = new CustomerManager();
 }
Exemplo n.º 17
0
 void Start()
 {
     CustomerManager.RegisterSpot(this);
 }
Exemplo n.º 18
0
 public AddCustomerCommand(CustomerManager manager)
 {
     _manager = manager;
 }
Exemplo n.º 19
0
        protected string GetFromInfo(int customerId)
        {
            string customerInfo = string.Empty;
            var    customer     = CustomerManager.GetCustomerById(customerId);

            if (customer != null && !customer.IsGuest)
            {
                if (CustomerManager.AllowViewingProfiles)
                {
                    customerInfo = string.Format("<a href=\"{0}\">{1}</a>", SEOHelper.GetUserProfileUrl(customer.CustomerId), Server.HtmlEncode(CustomerManager.FormatUserName(customer)));
                }
                else
                {
                    customerInfo = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                }
            }
            return(customerInfo);
        }
Exemplo n.º 20
0
        public resultForCustomers Post([FromBody] criteriaForCustomer critera)
        {
            CustomerManager manager = new CustomerManager();

            return(manager.QueryCustomers(critera));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request["w"]))
            btnCancel.OnClientClick = "top.$.LightBoxObject.close();return false;";
        else
        {
            btnCancel.OnClientClick = "location='Customers.aspx';return false;";

            if (!String.IsNullOrEmpty(Request["CustomerId"]))
                btnCancel.OnClientClick = "parent.location='Customers.aspx';return false;";
        }

        customerManager = new CustomerManager(this);
        lblMessage.Text = String.Empty;

        if (!String.IsNullOrEmpty(Request["CustomerId"]))
            Page.ViewState["CustomerId"] = Request["CustomerId"];

        //
        // Update
        //
        if (Page.ViewState["CustomerId"] != null)
        {
            litTitle.Visible = false;
            Page.ViewState["loaded"] = true;
            originalCustomer = customerManager.GetCustomer(Convert.ToInt32(Page.ViewState["CustomerId"]), Company.MatrixId.Value);

            if (!IsPostBack && originalCustomer != null)
            {
                customerComments.SubjectId = originalCustomer.CustomerId;
                customerComments.Visible = true;
                pnlCreateDate.Visible = true;

                if (originalCustomer.User != null)
                {
                    txtUserName.Text = originalCustomer.User.UserName;
                    txtPassword.Text = originalCustomer.User.Password;
                    lblPassword.Visible = false;
                    txtPassword.Visible = false;
                    chkRemoveUser.Visible = true;
                }

                //
                // The code below checks the type of profile(LegalEntityProfile/Profile)
                //
                if (originalCustomer.LegalEntityProfile != null)
                    ucProfile.CompanyProfileEntity = originalCustomer.LegalEntityProfile;
                else
                    ucProfile.ProfileEntity = originalCustomer.Profile;

                pnlOtherData.Visible = true;

                ucCurrFieldCreditLimit.CurrencyValue = originalCustomer.CreditLimit;

                if (originalCustomer.RepresentantId.HasValue)
                    cboRepresentant.SelectedValue = Convert.ToString(originalCustomer.RepresentantId);

                if (originalCustomer.CreatedDate.HasValue)
                    lblCreatedDate.Text = originalCustomer.CreatedDate.Value.Date.ToShortDateString();

                if (originalCustomer.CustomerTypeId.HasValue)
                    cboCustomerType.SelectedValue = originalCustomer.CustomerTypeId.ToString();


                ShowCustomerConfiguration(originalCustomer);
                //
                //load ranking value
                //
                if (originalCustomer.Ranking != null)
                    rtnRanking.CurrentRating = Convert.ToInt32(originalCustomer.Ranking);
            }
        }
        else
        {
            customerComments.Visible = false;

            //
            //  Legal Entity
            //
            if (Page.ViewState["LegalEntityProfileId"] != null)
            {
                originalCustomer = customerManager.GetCustomerByLegalEntityProfile(Company.MatrixId.Value, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"]));
                if (originalCustomer != null)
                {
                    Page.ViewState["ProfileExists"] = "0";

                    /*
                     * if isn't a postback set the values of company in profile_LegalEntity1
                     * else the values are reload in all postback
                     * 
                     */
                    if (!IsPostBack)
                    {
                        //SetVendorValue(originalcustomer);
                        ucProfile.CompanyProfileEntity = originalCustomer.LegalEntityProfile;
                    }
                }
            }

            //
            // Natural Person
            //
            if (Page.ViewState["ProfileId"] != null)
            {
                originalCustomer = customerManager.GetCustomerByProfile(Company.MatrixId.Value, Convert.ToInt32(Page.ViewState["ProfileId"]));
                if (originalCustomer != null)
                {
                    Page.ViewState["ProfileExists"] = "0";
                    /*
                     * if isn't a postback set the values of company in profile
                     * else the values are reload in all postback
                     *
                     */
                    if (!IsPostBack)
                        ucProfile.ProfileEntity = originalCustomer.Profile;

                }
            }
        }
    }
Exemplo n.º 22
0
 public void Initialize(CustomerManager manager, CustomerRequest newRequest, GameObject canvas)
 {
     customerRequest = newRequest;
     this.manager    = manager;
     requestedItems.AddRange(newRequest.acceptedAI);
 }
Exemplo n.º 23
0
        //Insert the cart into the database
        public IActionResult ProceedCheckout(int idAvailability, int idStaff, TimeSpan choosenTime)
        {
            ViewBag.username    = HttpContext.Session.GetString("username");
            ViewBag.userType    = HttpContext.Session.GetInt32("userType");
            ViewBag.totalAmount = HttpContext.Session.GetInt32("TotalAmount");
            int                 idCredentials = (int)HttpContext.Session.GetInt32("id");
            CustomerManager     cManger       = new CustomerManager(Configuration);
            int                 idCustomer    = cManger.GetCustomerIDByCredentials(idCredentials);
            AvailibilityManager aManager      = new AvailibilityManager(Configuration);

            if (idAvailability % 15 < 14 && idAvailability % 15 >= 1)
            {
                //additioning the counter of the cur. time + cur. time + 15 + cur. time + 30
                int totalCounter = aManager.GetCounter(idAvailability) + aManager.GetCounter(idAvailability + 1) + aManager.GetCounter(idAvailability + 2);

                if (totalCounter >= 4)
                {
                    //Make deliveryBoy unavailable at the choosen time, 0 means unavailable
                    aManager.UpdateAvailability(idAvailability, 0);
                }

                for (int i = idAvailability; i <= idAvailability + 2; i++)
                {
                    //increment counter
                    aManager.IncrementCounter(i);
                }
            }
            else if (idAvailability % 15 == 14)

            {
                int totalCounter = aManager.GetCounter(idAvailability) + aManager.GetCounter(idAvailability + 1);

                if (totalCounter >= 4)
                {
                    //Make deliveryBoy unavailable at the choosen time
                    aManager.UpdateAvailability(idAvailability, 0);
                }

                for (int i = idAvailability; i <= idAvailability + 1; i++)
                {
                    //increment counter
                    aManager.IncrementCounter(i);
                }
            }
            else if (idAvailability % 15 == 0)
            {
                int totalCounter = aManager.GetCounter(idAvailability);

                if (totalCounter >= 4)
                {
                    //Make deliveryBoy unavailable at the choosen time
                    aManager.UpdateAvailability(idAvailability, 0);
                }

                aManager.IncrementCounter(idAvailability);
            }

            //First we add the delivery
            DeliveryManager dManager = new DeliveryManager(Configuration);

            dManager.AddDelivery(choosenTime, idStaff);
            int lastDelivery = dManager.GetLastId();

            OrderManager oManager = new OrderManager(Configuration);

            //Then we create the order
            oManager.AddOrder(idCustomer, lastDelivery);
            int lastOrder = oManager.GetLastId();
            //Finaly we link each dish to the order in the dish_order table
            List <Item>         cart      = SessionHelper.GetObjectFromJson <List <Item> >(HttpContext.Session, "cart");
            Dishes_orderManager doManager = new Dishes_orderManager(Configuration);

            foreach (Item dish in cart)
            {
                doManager.AddDishes_order(dish.Dishe.idDishes, lastOrder, dish.Quantity);
            }
            //This way we respect every foreign key and we do not generate errors.
            cart = null;
            //Clean up cart
            SessionHelper.SetObjectAsJson(HttpContext.Session, "cart", cart);
            HttpContext.Session.SetInt32("TotalAmount", 0);
            return(View());
        }
 public CUstListFromFinance(CreateFinanceWindow previousWindow)
 {
     _previousWindow = previousWindow;
     InitializeComponent();
     BussinessListView.ItemsSource = CustomerManager.GetCustomers();
 }
Exemplo n.º 25
0
        private IFuelPumpManager GetFuelPumpManagerObject()
        {
            var promomanager = new PromoManager(
                new ApiResourceManager(),
                new PromoService());

            var policyManager = new PolicyManager(
                new PolicyService(),
                new LoginService(),
                new UserService(),
                promomanager,
                new DipInputService(),
                new FuelService());

            var loginManager = new LoginManager(
                new UtilityService(),
                new UserService(),
                new LoginService(),
                new ApiResourceManager(),
                new TillService(),
                new ShiftService(),
                policyManager);
            var stockManager = new StockManager(new StockService(), policyManager
                                                , new TaxService(),
                                                new ApiResourceManager(),
                                                loginManager);

            var saleLineManager = new SaleLineManager(
                new ApiResourceManager(),
                policyManager,
                new StockService(),
                new FuelService(),
                new UtilityService(),
                loginManager,
                promomanager,
                stockManager
                );

            var creditCardManager = new CreditCardManager(
                new CardService(),
                new ApiResourceManager(),
                new PolicyManager(
                    new PolicyService(),
                    new LoginService(),
                    new UserService(),
                    promomanager,
                    new DipInputService(), new FuelService()), new TenderService(),
                new CustomerService(),
                new CardPromptManager(
                    new CardService(),
                    policyManager)
                );
            var cashBonusService = new CashBonusService();

            var carwashManager = new CarwashManager(policyManager);

            var resourceManager = new ApiResourceManager();

            var customerManager = new CustomerManager(
                new CustomerService(),
                policyManager,
                new ApiResourceManager(),
                creditCardManager
                );

            var teSystemManager = new TeSystemManager(policyManager, new TreatyService(),
                                                      new TaxService(), new TeSystemService(), new FuelPumpService(), new ReasonService(),
                                                      new StockService());
            var treatyManager = new TreatyManager(policyManager, new ApiResourceManager(), new TreatyService(), teSystemManager);

            var prepaymanager = new PrepayManager(new PrepayService(), new ApiResourceManager());

            var wexManager = new WexManager(new WexService(), resourceManager, policyManager, new EncryptDecryptUtilityManager(new EncryptDecryptUtilityService()));

            // var cashBonusManager = new CashBonusManager(cashBonusService, policyManager, loginManager, resourceManager);

            return(new FuelPumpManager(
                       new GetPropertyManager(new FuelPumpService()),
                       new FuelPumpService(),
                       policyManager,
                       new SaleManager(
                           policyManager,
                           new SaleService(),
                           new ApiResourceManager(),
                           loginManager,
                           new LoginService(),
                           new StockService(),
                           new UtilityService(),
                           new TillService(),
                           new CustomerService(),
                           new CardService(),
                           new TaxService(),
                           saleLineManager,
                           new SaleHeadManager(
                               new SaleService(),
                               customerManager,
                               policyManager),
                           customerManager,
                           new ReasonService(),
                           new GivexClientManager(
                               new ApiResourceManager(),
                               policyManager),
                           creditCardManager, treatyManager,
                           new EncryptDecryptUtilityManager(new EncryptDecryptUtilityService()),
                           new MainManager(new UtilityService(), policyManager),
                           prepaymanager,
                           carwashManager),
                       saleLineManager,
                       new ApiResourceManager(),
                       new TeSystemManager(
                           new PolicyManager(
                               new PolicyService(),
                               new LoginService(),
                               new UserService(),
                               new PromoManager(
                                   new ApiResourceManager(),
                                   new PromoService()),
                               new DipInputService(), new FuelService()),
                           new TreatyService(),
                           new TaxService(),
                           new TeSystemService(),
                           new FuelPumpService(),
                           new ReasonService(),
                           new StockService()),
                       new FuelService(),
                       new PrepayManager(
                           new PrepayService(),
                           new ApiResourceManager()),
                       new TillService(),
                       new TillCloseService()));
        }
Exemplo n.º 26
0
 private void InitCustomers()
 {
     Cursor.Current = Cursors.WaitCursor;
     customerBindingSource.DataSource = CustomerManager.GetAll();
     Cursor.Current = Cursors.Default;
 }
Exemplo n.º 27
0
 public String UpdateCustomer(Customer cus)
 {
     return(CustomerManager.getInstance().UpdateCustomer(cus));
 }
 //Get Customer Account
 public Account GetCustomerAccount(string AccNo)
 {
     return(CustomerManager.FindAccount(AccNo));
 }
Exemplo n.º 29
0
        protected void btnSaveCustomerInfo_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    var customer = NopContext.Current.User;
                    if (customer.Email.ToLower() != txtEmail.Text.ToLower().Trim())
                    {
                        customer = CustomerManager.SetEmail(customer.CustomerId, txtEmail.Text.Trim());
                    }

                    if (CustomerManager.FormFieldGenderEnabled)
                    {
                        if (rbGenderM.Checked)
                        {
                            customer.Gender = "M";
                        }
                        else
                        {
                            customer.Gender = "F";
                        }
                    }
                    customer.FirstName = txtFirstName.Text;
                    customer.LastName  = txtLastName.Text;
                    if (CustomerManager.FormFieldDateOfBirthEnabled)
                    {
                        customer.DateOfBirth = dtDateOfBirth.SelectedDate;
                    }
                    if (CustomerManager.FormFieldCompanyEnabled)
                    {
                        customer.Company = txtCompany.Text;
                    }
                    if (CustomerManager.FormFieldStreetAddressEnabled)
                    {
                        customer.StreetAddress = txtStreetAddress.Text;
                    }
                    if (CustomerManager.FormFieldStreetAddress2Enabled)
                    {
                        customer.StreetAddress2 = txtStreetAddress2.Text;
                    }
                    if (CustomerManager.FormFieldPostCodeEnabled)
                    {
                        customer.ZipPostalCode = txtZipPostalCode.Text;
                    }
                    if (CustomerManager.FormFieldCityEnabled)
                    {
                        customer.City = txtCity.Text;
                    }
                    if (CustomerManager.FormFieldCountryEnabled)
                    {
                        customer.CountryId = int.Parse(ddlCountry.SelectedItem.Value);
                    }
                    if (CustomerManager.FormFieldCountryEnabled &&
                        CustomerManager.FormFieldStateEnabled)
                    {
                        customer.StateProvinceId = int.Parse(ddlStateProvince.SelectedItem.Value);
                    }
                    if (CustomerManager.FormFieldPhoneEnabled)
                    {
                        customer.PhoneNumber = txtPhoneNumber.Text;
                    }
                    if (CustomerManager.FormFieldFaxEnabled)
                    {
                        customer.FaxNumber = txtFaxNumber.Text;
                    }
                    customer.ReceiveNewsletter = cbNewsletter.Checked;

                    if (DateTimeHelper.AllowCustomersToSetTimeZone)
                    {
                        if (ddlTimeZone.SelectedItem != null && !String.IsNullOrEmpty(ddlTimeZone.SelectedItem.Value))
                        {
                            string timeZoneId = ddlTimeZone.SelectedItem.Value;
                            DateTimeHelper.CurrentTimeZone = DateTimeHelper.FindTimeZoneById(timeZoneId);
                        }
                    }

                    if (ForumManager.ForumsEnabled && ForumManager.SignaturesEnabled)
                    {
                        customer = CustomerManager.SetCustomerSignature(customer.CustomerId, txtSignature.Text);
                    }
                }
                catch (Exception exc)
                {
                    ErrorMessage.Text = exc.Message;
                }
            }
        }
Exemplo n.º 30
0
 public CustomerListWindowFromTicket(CreateTicketWindow previousWindow)
 {
     _previousWindow = previousWindow;
     InitializeComponent();
     this.BussinessListView.ItemsSource = CustomerManager.GetCustomers();
 }
Exemplo n.º 31
0
        public static List <Store> MapStoreData(DataTable dTstore, DataTable dtCustStock, DataTable dtStockMovement)
        {
            List <Store> ListStores = new List <Store>();

            foreach (DataRow dr in dTstore.Rows)
            {
                Store mapData = new Store();
                mapData.Id            = new Guid(dr["id"].ToString());
                mapData.Status        = (StoreStatus)Enum.Parse(typeof(StoreStatus), dr["status"].ToString());
                mapData.SaleStationId = CommonDataManager.GetSaleStation(dr["SaleStationId"].ToString());

                mapData.CreatedOn = dr["CreatedOn"] != DBNull.Value ? DateTime.Parse(dr["CreatedOn"].ToString()) : DateTime.MinValue;
                mapData.CreatedBy = dr["CreatedBy"] != null?UserManager.GetUserRef(dr["CreatedBy"].ToString()) : UserManager.GetDefaultRef();

                mapData.ModifiedOn = dr["ModifiedOn"] != DBNull.Value ? DateTime.Parse(dr["ModifiedOn"].ToString()) : DateTime.MinValue;
                mapData.ModifiedBy = dr["ModifiedBy"] != null?UserManager.GetUserRef(dr["ModifiedBy"].ToString()) : UserManager.GetDefaultRef();

                mapData.Name     = dr["Name"].ToString();
                mapData.Location = dr["Location"].ToString();
                mapData.Capacity = decimal.Parse(dr["Capacity"].ToString());

                mapData.Stock = new List <CustomerStock>();

                foreach (DataRow drCustStock in dtCustStock.Rows)
                {
                    Guid StoreId = drCustStock["StoreId"] != null ? new Guid(drCustStock["StoreId"].ToString()) : Guid.Empty;
                    if (StoreId != Guid.Empty && StoreId == mapData.Id)
                    {
                        CustomerStock CustStock = new CustomerStock();
                        CustStock.Customer = drCustStock["CustomerId"] != null?CustomerManager.GetCustomerRef(drCustStock["CustomerId"].ToString()) : CustomerManager.GetDefaultRef();

                        CustStock.Store = new Reference()
                        {
                            Id = mapData.Id, Name = mapData.Name
                        };
                        CustStock.Vessel = drCustStock["Vessel"] != null?CommonDataManager.GetVessel(drCustStock["Vessel"].ToString()) : CommonDataManager.GetDefaultRef();

                        CustStock.Origin = drCustStock["Origin"] != null?CommonDataManager.GetOrigin(drCustStock["Origin"].ToString()) : CommonDataManager.GetDefaultRef();

                        CustStock.Size = drCustStock["Size"] != null?CommonDataManager.GetSize(drCustStock["Size"].ToString()) : CommonDataManager.GetDefaultRef();

                        CustStock.Quantity = drCustStock["Quantity"] != null?decimal.Parse(drCustStock["Quantity"].ToString()) : 0;

                        mapData.Stock.Add(CustStock);
                    }
                }

                mapData.ListStockMovement = new List <StockMovement>();
                foreach (DataRow drStMovement in dtStockMovement.Rows)
                {
                    Guid StoreId = drStMovement["StoreId"] != null ? new Guid(drStMovement["StoreId"].ToString()) : Guid.Empty;
                    if (StoreId != Guid.Empty && StoreId == mapData.Id)
                    {
                        StockMovement StMovement = new StockMovement();
                        StMovement.Customer = drStMovement["CustomerId"] != null?CustomerManager.GetCustomerRef(drStMovement["CustomerId"].ToString()) : CustomerManager.GetDefaultRef();

                        StMovement.Store = new Reference()
                        {
                            Id = mapData.Id, Name = mapData.Name
                        };
                        StMovement.Type       = (StMovType)Enum.Parse(typeof(StMovType), drStMovement["Type"].ToString());
                        StMovement.HistoryRef = drStMovement["Reference"] != null ? drStMovement["Reference"].ToString() : "";
                        StMovement.Quantity   = drStMovement["Quantity"] != null?decimal.Parse(drStMovement["Quantity"].ToString()) : 0;

                        StMovement.IsIn = drStMovement["InOut"] != null?bool.Parse(drStMovement["InOut"].ToString()) : false;

                        StMovement.Origin = drStMovement["Origin"] != null?CommonDataManager.GetOrigin(drStMovement["Origin"].ToString()) : CommonDataManager.GetDefaultRef();

                        StMovement.Vessel = drStMovement["Vessel"] != null?CommonDataManager.GetVessel(drStMovement["Vessel"].ToString()) : CommonDataManager.GetDefaultRef();

                        StMovement.Size = drStMovement["Size"] != null?CommonDataManager.GetSize(drStMovement["Size"].ToString()) : CommonDataManager.GetDefaultRef();

                        mapData.ListStockMovement.Add(StMovement);
                    }
                }

                ListStores.Add(mapData);
                mapData = null;
            }
            return(ListStores);
        }
    public static bool SaveCustomerFollowUp(string[] customerFollowUp)
    {
        using (var customerManager = new CustomerManager(null))
        {
            var cf = new CustomerFollowup();
            var originalCustomerFollowUp = new CustomerFollowup();

            if (!String.IsNullOrEmpty(customerFollowUp[8]))
            {
                originalCustomerFollowUp = customerManager.GetCustomerFollowup(Convert.ToInt32(customerFollowUp[1]), Convert.ToInt32(customerFollowUp[8]));
                cf.CopyPropertiesFrom(originalCustomerFollowUp);
            }

            cf.ContactId = Convert.ToInt32(customerFollowUp[0]);
            cf.CompanyId = Convert.ToInt32(customerFollowUp[1]);
            cf.UserId = Convert.ToInt32(customerFollowUp[2]);

            cf.Description = customerFollowUp[3].ToString();

            if (!String.IsNullOrEmpty(customerFollowUp[4]))
                cf.CustomerFollowupActionId = Convert.ToInt32(customerFollowUp[4]);

            if (!String.IsNullOrEmpty(customerFollowUp[8]))
            {
                if (!IsAppointment(customerFollowUp))
                    customerManager.UpdateCustomerFollowup(originalCustomerFollowUp, cf, null, null, null);
                else
                    customerManager.UpdateCustomerFollowup(originalCustomerFollowUp, cf, Convert.ToInt32(customerFollowUp[9]), Convert.ToDateTime(customerFollowUp[6]), customerFollowUp[10]);
            }
            else
                if (!IsAppointment(customerFollowUp))
                    customerManager.InsertCustomerFollowup(cf, null, null, null);
                else
                    customerManager.InsertCustomerFollowup(cf, Convert.ToInt32(customerFollowUp[9]), Convert.ToDateTime(customerFollowUp[6]), customerFollowUp[10]);

            if (cf.CustomerFollowupId != 0)
                return true;
            else
                return false;
        }
    }
    protected void cboCustomerCalls_SelectedIndexChanged(object sender, EventArgs e)
    {
        CustomerCall customerCall = null;
        cboCustomerEquipments.SelectedValue = String.Empty;
        pnlShowEquipment.Visible = false;

        if (!String.IsNullOrEmpty(cboCustomerCalls.SelectedValue))
            customerCall = new CustomerManager(this).GetCustomerCall(Convert.ToInt32(cboCustomerCalls.SelectedValue));

        if (customerCall.CustomerEquipmentId.HasValue)
            ShowCustomerEquipment(customerCall.CustomerEquipment);
    }
Exemplo n.º 34
0
 public static bool DeleteCustomer(int customerid, int companyid)
 {
     bool result = true;
     using (CustomerManager customerManager = new CustomerManager(null))
     {
         try
         {
             customerManager.Delete(customerManager.GetCustomer(customerid, companyid));
         }
         catch (System.Data.SqlClient.SqlException e)
         {
             result = false;
         }
     }
     return result;
 }
Exemplo n.º 35
0
 public CustomerController(CustomerManager customerManager)
 {
     _customerManager = customerManager;
 }
 public static bool CloseCustomerCall(int customerCallId)
 {
     bool result = true;
     using (var customerManager = new CustomerManager(null))
     {
         try
         {
             customerManager.CloseCustomerCall(customerCallId);
         }
         catch
         {
             result = false;
         }
     }
     return result;
 }
Exemplo n.º 37
0
    protected void odsSearchCustomer_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {
        CustomerManager customerManager = new CustomerManager(this);
        Hashtable htCustomer = new Hashtable();

        htCustomer.Add("CompanyId", Company.MatrixId); 
        htCustomer.Add("SelectedCustomer", txtSelectedCustomer.Text);
        htCustomer.Add("CPF", txtCPF.Text);
        htCustomer.Add("CNPJ", txtCNPJ.Text);
        htCustomer.Add("Email", txtMail.Text);
        htCustomer.Add("Phone", txtPhone.Text);
        htCustomer.Add("EquipmentName", txtEquipment.Text);
        htCustomer.Add("Ranking", rtnRanking.CurrentRating);
        htCustomer.Add("CustomerTypeId", cboCustomerType.SelectedValue);

        var represetantUser = new RepresentantManager(this).GetRepresentantUser(User.Identity.UserId);

        if (represetantUser != null)
            htCustomer.Add("representantId", represetantUser.RepresentantId.ToString());
        else
            htCustomer.Add("representantId", String.Empty);

        e.InputParameters["htCustomer"] = htCustomer;
    }
Exemplo n.º 38
0
        static void Main(string[] args)
        {
            CarManager carManager = new CarManager(new EfCarDal());

            UserManager userManager = new UserManager(new EfUserDal());

            CustomerManager customerManager = new CustomerManager(new EfCustomerDal());

            RentalManager rentalManager = new RentalManager(new EfRentalDal());

            bool giris = true;

            while (giris)
            {
                Console.WriteLine("Ne işlem yapmak istiyorsununuz ?\n\n----------------------------------------");

                Console.WriteLine("********Araba İşlemleri*********\n\n" +
                                  "Ekleme işlemi yapmak için : 1\n" +
                                  "Silme işlemi yapmak için : 2\n" +
                                  "Güncelleme işlemi için : 3\n" +
                                  "Bütün kayıtları getirmek için : 4\n" +
                                  "Modeline göre kayıt getirmek için : 5\n" +
                                  "Rengine göre kayıt getirmek için : 6\n" +
                                  "Genel araba bilgisi için : 7\n\n" +
                                  "********Kullanıcı İşlemleri********\n\n" +
                                  "Kullanıcı eklemek için : 8\n" +
                                  "Kullanıcı silmek için : 9\n" +
                                  "Kullanıcı güncellemek için : 10\n" +
                                  "Bütün kayıtları getirmek için : 11\n" +
                                  "Müşteri eklemek için : 12\n" +
                                  "Müşteri silmek için : 13\n" +
                                  "Müşteri güncellemek için : 14\n" +
                                  "Araba kirala : 15\n" +
                                  "Kiralama bilgisini güncelle : 16\n" +
                                  "Kira bilgilerini getir : 17\n" +
                                  "Çıkış için : 0");



                int secim = Convert.ToInt32(Console.ReadLine());


                switch (secim)
                {
                case 1:
                    AddCar(carManager);
                    break;

                case 2:
                {
                    DeleteCar(carManager);
                    break;
                }

                case 3:
                {
                    UpdateCar(carManager);
                    break;
                }

                case 4:
                {
                    GetCarsInfo(carManager);
                    break;
                }

                case 5:
                {
                    GetCarsByBrandId(carManager);
                    break;
                }

                case 6:
                {
                    GetCarsByColorId(carManager);
                    break;
                }

                case 7:
                {
                    GetCarDetails(carManager);

                    break;
                }

                case 8:
                {
                    AddUser(userManager);

                    break;
                }

                case 9:
                {
                    DeleteUser(userManager);

                    break;
                }

                case 10:
                {
                    UpdateUser(userManager);

                    break;
                }

                case 11:
                {
                    GetUsersInfo(userManager);

                    break;
                }

                case 12:
                {
                    AddCustomer(customerManager);

                    break;
                }

                case 13:
                {
                    DeleteCustomer(customerManager);
                    break;
                }

                case 14:
                {
                    UpdateCustomer(customerManager);

                    break;
                }

                case 15:
                {
                    RentalAdd(rentalManager);

                    break;
                }

                case 16:
                {
                    RentalUpdate(rentalManager);

                    break;
                }

                case 17:
                {
                    GetRentals(rentalManager);

                    break;
                }

                case 0:
                    giris = false;
                    break;
                }
            }
        }
Exemplo n.º 39
0
        /// <summary>
        /// Called when Button SendToViewModel is clicked
        /// </summary>
        private void OnAdd()
        {

            ProfileInfo userInfo = new ProfileInfo();
            userInfo.setFirstName(CustomerFirstName);
            userInfo.setLastName(CustomerLastName);
            userInfo.setEmail(CustomerEmail);
            userInfo.setPhone(CustomerPhone);
            userInfo.setFax(CustomerFax);
            userInfo.setWebsite(CustomerWebsite);



            CustomerInfo customerInfo = new CustomerInfo();
            customerInfo.setUserInfo(userInfo);

            CustomerManager customerManager = new CustomerManager();
            customerManager.createCustomer(customerInfo);


            MessageBox.Show("Save Successfully");
        }
Exemplo n.º 40
0
        public void CheckUserScore()
        {
            string sql = @"select customersysno,sum(pointamount) as PointLogTotal ,validscore
						   from customer_pointlog cp
						   inner join customer c on c.sysno = cp.customersysno
						   where c.status ="                         + (int)AppEnum.BiStatus.Valid
                         + @" group by customersysno,validscore
						   having sum(pointamount)<>validscore"                        ;
            DataSet   ds        = SqlHelper.ExecuteDataSet(sql);
            Hashtable errorHash = new Hashtable();
            Hashtable failHash  = new Hashtable();
            TCPMail   oMail     = new TCPMail();

            if (Util.HasMoreRow(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    try
                    {
                        Hashtable paramHash = new Hashtable();
                        paramHash.Add("SysNo", (int)dr["CustomerSysNo"]);
                        paramHash.Add("Status", (int)AppEnum.BiStatus.InValid);
                        CustomerManager.GetInstance().Update(paramHash);
                        errorHash.Add((int)dr["CustomerSysNo"], dr);
                    }
                    catch
                    {
                        failHash.Add((int)dr["CustomerSysNo"], dr);
                    }
                }
            }
            if (errorHash.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<table align='center' border='0' cellpadding='0' cellspacing='0'>");
                sb.Append(" <tr>");
                sb.Append("  <td>CustomerSysNo</td>");
                sb.Append("  <td>PointLogTotal</td>");
                sb.Append("  <td>ValidScore</td>");
                sb.Append(" </tr>");
                foreach (DataRow drer in errorHash.Values)
                {
                    sb.Append("<tr>");
                    sb.Append("	<td>" + drer["CustomerSysNo"].ToString() + "</td>");
                    sb.Append(" <td>" + drer["PointLogTotal"].ToString() + "</td>");
                    sb.Append(" <td>" + drer["ValidScore"].ToString() + "</td>");
                    sb.Append("</tr>");
                }
                sb.Append("</table>");
                oMail.Send(AppConfig.AdminEmail, "ScoreErrorUpdated:" + DateTime.Now.ToLongDateString(), sb.ToString());
            }
            if (failHash.Count > 0)
            {
                StringBuilder sb1 = new StringBuilder();
                sb1.Append("<table align='center' border='0' cellpadding='0' cellspacing='0'>");
                sb1.Append(" <tr>");
                sb1.Append("  <td>CustomerSysNo</td>");
                sb1.Append("  <td>PointLogTotal</td>");
                sb1.Append("  <td>ValidScore</td>");
                sb1.Append(" </tr>");
                foreach (DataRow drer in errorHash.Values)
                {
                    sb1.Append("<tr>");
                    sb1.Append("	<td>"+ drer["CustomerSysNo"].ToString() + "</td>");
                    sb1.Append(" <td>" + drer["PointLogTotal"].ToString() + "</td>");
                    sb1.Append(" <td>" + drer["ValidScore"].ToString() + "</td>");
                    sb1.Append("</tr>");
                }
                sb1.Append("</table>");
                oMail.Send(AppConfig.AdminEmail, "ScoreErrorNotUpdated:" + DateTime.Now.ToLongDateString(), sb1.ToString());
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Customer customer = new Customer();

        // Clone the original customer for the linq track changes 
        if (originalCustomer != null)
        {
            customer.CopyPropertiesFrom(originalCustomer);
        }

        customer.BlockSalesInDebit = true;

        if (Company.MatrixId.HasValue)
            customer.CompanyId = Company.MatrixId.Value;
        else
            customer.CompanyId = Company.CompanyId;

        customer.BankId = null;
        if (!String.IsNullOrEmpty(cboBank.SelectedValue))
            customer.BankId = Convert.ToInt32(cboBank.SelectedValue);

        customer.Agency = null;
        if (!String.IsNullOrEmpty(txtAgency.Text))
            customer.Agency = txtAgency.Text;

        customer.AccountNumber = null;
        if (!String.IsNullOrEmpty(txtAccountNumber.Text))
            customer.AccountNumber = txtAccountNumber.Text;

        customer.AccountCreatedDate = null;
        if (!String.IsNullOrEmpty(txtAccountCreatedDate.Text))
            customer.AccountCreatedDate = Convert.ToDateTime(txtAccountCreatedDate.Text);

        ///vendor
        if (!String.IsNullOrEmpty(cboVendors.SelectedValue))
            customer.SalesPersonId = Convert.ToInt32(cboVendors.SelectedValue);

        if (Page.ViewState["SalesPersonId"] != null)
            customer.SalesPersonId = Convert.ToInt32(Page.ViewState["SalesPersonId"]);

        if (ucVendorComission.CurrencyValue.HasValue)
            customer.SalesPersonCommission = ucVendorComission.CurrencyValue;
      
        if (!String.IsNullOrEmpty(cboSupplementalVendor.SelectedValue))
            customer.SupplementalSalesPersonId = Convert.ToInt32(cboSupplementalVendor.SelectedValue);

        if (Page.ViewState["supplementalSalesPersonId"] != null)
            customer.SupplementalSalesPersonId = Convert.ToInt32(Page.ViewState["supplementalSalesPersonId"]);
        
        if (ucSupplementalVendorComission.CurrencyValue.HasValue)
            customer.SupplementalSalesPersonCommission = ucSupplementalVendorComission.CurrencyValue;

        customer.RepresentantId = null;
        if (!String.IsNullOrEmpty(cboRepresentant.SelectedValue))
            customer.RepresentantId = Convert.ToInt32(cboRepresentant.SelectedValue);

        customer.CreditLimit = ucCurrFieldCreditLimit.CurrencyValue;
        
        customer.CustomerTypeId = null;
        if (!String.IsNullOrEmpty(cboCustomerType.SelectedValue))
            customer.CustomerTypeId = Convert.ToInt32(cboCustomerType.SelectedValue);

        //fill field ranking
        customer.Ranking = rtnRanking.CurrentRating;

        if (ucProfile.ProfileEntity != null)
        {
            if (String.IsNullOrEmpty(ucProfile.ProfileEntity.Phone.Trim('-', '_', '(', ')')) && String.IsNullOrEmpty(ucProfile.ProfileEntity.CellPhone.Trim('-', '_', '(', ')')) && String.IsNullOrEmpty(ucProfile.ProfileEntity.HomePhone.Trim('-', '_', '(', ')')))
            {
                ShowError("Ao menos um telefone deve ser preenchido!");
                return;
            }

            // Add the entity to Insert
            if (ucProfile.ProfileEntity.ProfileId == 0)
                customer.Profile = ucProfile.ProfileEntity;
        }
        else
        {
            // Add the entity to Insert
            customer.LegalEntityProfileId = ucProfile.CompanyProfileEntity.LegalEntityProfileId;
            if (ucProfile.CompanyProfileEntity.LegalEntityProfileId == 0)
                customer.LegalEntityProfile = ucProfile.CompanyProfileEntity;
        }

        //
        //Insert
        //

        if (Page.ViewState["CustomerId"] == null && Page.ViewState["ProfileExists"] != "0")
        {
            membershipManager = new MembershipManager(this);
            companyManager = new CompanyManager(this);

            if (!String.IsNullOrEmpty(txtUserName.Text))
            {
                customer.CreatedByUser = User.Identity.UserName;
                status = customerManager.Insert(customer, FillUser());

                ShowMessage(status);
                chkRemoveUser.Visible = (status == MembershipCreateStatus.Success);
                lblPassword.Visible = txtPassword.Visible = !(status == MembershipCreateStatus.Success);


                if (status == MembershipCreateStatus.Success)
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "location='Customer.aspx?CustomerId=" + customer.CustomerId + "';", true);

                return;
            }

            customer.CreatedByUser = User.Identity.UserName;
            customerManager.Insert(customer);
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "location='Customer.aspx?CustomerId=" + customer.CustomerId + "';", true);

        } // Update
        else
        {
            membershipManager = new MembershipManager(this);
            customerManager = new CustomerManager(this);
            var user = FillUser();

            customer.ModifiedByUser = User.Identity.UserName;
            //
            //Delete the user account of customer
            //
            if (chkRemoveUser.Checked)
            {                
                customer.User = null;
                lblMessage.Text = String.Empty;
                chkRemoveUser.Checked = false;
                chkRemoveUser.Visible = false;
                txtUserName.Text = String.Empty;
                lblPassword.Visible = txtPassword.Visible = true;

                customerManager.Update(originalCustomer, customer);
                return;
            }

            if (originalCustomer.UserId.HasValue)
            {
                if (originalCustomer.User.UserName != txtUserName.Text)
                {
                    if (customerManager.GetCustomerByUserName(Company.CompanyId, txtUserName.Text) != null)
                    {
                        lblMessage.Text = "Já existe um cliente com esse usuário nesta empresa!";
                        return;
                    }

                    customerManager.UpdateUserNameOfCustomer(originalCustomer, txtUserName.Text);
                    return;
                }
            }

            if (!String.IsNullOrEmpty(txtUserName.Text) && !originalCustomer.UserId.HasValue)
            {
                if (customerManager.GetCustomerByUserName(Company.CompanyId, txtUserName.Text) != null)
                {
                    lblMessage.Text = "Já existe um cliente com esse usuário nesta empresa!";
                    return;
                }

                membershipManager.Insert(user, out status, true);

                if (status == MembershipCreateStatus.Success)
                {
                    customer.UserId = user.UserId;
                    customerManager.Update(originalCustomer, customer);

                    chkRemoveUser.Visible = true;
                    txtPassword.Visible = false;
                    lblPassword.Visible = false;
                }

            }
         
            customerManager.Update(originalCustomer, customer);

            //
            // In case of cnpj/cpf already exists in another category but the same cnpj/cpf is not yet a customer
            // the data will be loaded and save as update not insert, then this code redirects correctly to finalize
            // the register.
            //
            if (Page.ViewState["CustomerId"] == null)
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "location='Customer.aspx?CustomerId=" + customer.CustomerId + "';", true);
        }
    }
Exemplo n.º 42
0
        //protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        //{
        //    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        //    {
        //        Label lbl1 = e.Item.FindControl("lblIsDefault") as Label;
        //        Label lbl2 = e.Item.FindControl("lblBrief") as Label;
        //        ImageButton imgbtn = e.Item.FindControl("btnSelect") as ImageButton;

        //        int IsDefault = Int32.Parse(lbl1.Text);
        //        if (IsDefault == (int)AppEnum.BiStatus.Valid)
        //        {
        //            lbl2.Text = lbl2.Text + "[默认]";
        //            imgbtn.ImageUrl = "../Images/site/SelectedIcon.jpg";

        //            int sysno = Int32.Parse(DataList1.DataKeys[e.Item.ItemIndex].ToString());
        //            lblSysNo.Text = sysno.ToString();

        //            CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
        //            txtBrief.Text = o.Brief;
        //            txtName.Text = o.Name;
        //            txtContact.Text = o.Contact;
        //            txtCellPhone.Text = o.CellPhone;
        //            txtPhone.Text = o.Phone;
        //            scArea.AreaSysNo = o.AreaSysNo;
        //            txtAddress.Text = o.Address;
        //            txtZip.Text = o.Zip;
        //            txtFax.Text = o.Fax;
        //        }
        //        else
        //        {
        //            imgbtn.ImageUrl = "../Images/site/UnSelectedIcon.jpg";
        //        }
        //    }
        //}

        protected void btnNext_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入收货人姓名!";
                return;
            }

            if (txtAddress.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入联系地址!";
                return;
            }

            if (txtPhone.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入联系电话!";
                return;
            }

            if (scArea.DistrictSysNo == AppConst.IntNull)
            {
                lblErrMsg.Text = "请选择地区(包括省、市、区县)";
                return;
            }

            if (txtCellPhone.Text.Trim() != "")
            {
                if (!Util.IsCellNumber(txtCellPhone.Text.Trim()))
                {
                    lblErrMsg.Text = "手机号码格式不正确,您可以不输入";
                    return;
                }
            }

            if (txtZip.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入邮政编码!";
                return;
            }
            if (txtZip.Text.Trim() != "")
            {
                if (!Util.IsZipCode(txtZip.Text.Trim()))
                {
                    lblErrMsg.Text = "邮政编码格式不正确!";
                    return;
                }
            }

            string msgLimited1 = "";  //普包、EMS限运
            string msgLimited2 = "";  //圆通航空限运

            Hashtable cartHash = CartManager.GetInstance().GetCartHash();

            if (cartHash.Count == 0)
            {
                Response.Redirect("ShoppingCart.aspx");
            }
            Hashtable sysNoHash = new Hashtable(5);

            foreach (CartInfo cartInfo in cartHash.Values)
            {
                sysNoHash.Add(cartInfo.ProductSysNo, null);
            }

            //笔记本、打火机 是圆通航空限运,笔记本是普包、EMS不限运
            string LimitedShip = "";  //包含1,为盘片、音箱耳机、液体、打火机;包含2为笔记本、打火机,1为普包、EMS全部限运,2为圆通航空限运

            Hashtable ProductHash = ProductManager.GetInstance().LoadProducts(sysNoHash);

            foreach (ProductBasicInfo oInfo in ProductHash.Values)
            {
                //盘片、音箱耳机、液体、打火机, 笔记本、液晶显示器、液晶电视
                //if (",62,64,67,72,73,74,83,169,170,171,186,191,196,197,198,210,214,239,287,434,111,234,386,562,576,577,578,579,580,".IndexOf("," + oInfo.C3SysNo + ",") >= 0)
                //笔记本,液晶不再限运
                if (",62,64,67,72,73,74,83,169,170,171,186,191,196,197,198,210,214,239,287,434,576,577,578,579,580,".IndexOf("," + oInfo.C3SysNo + ",") >= 0)
                {
                    msgLimited1 += oInfo.ProductName + "<br />";
                    LimitedShip += "1";
                }
                if (",234,562,434,576,577,578,579,580,".IndexOf("," + oInfo.C3SysNo + ",") >= 0)  //笔记本、打火机
                {
                    LimitedShip += "2";
                }
                if (oInfo.C3SysNo == 234) //笔记本
                {
                    msgLimited2 += oInfo.ProductName + "<br />";
                }
            }
            if (LimitedShip.Length > 0)
            {
                Session["HasLimitedShipProduct"]      = LimitedShip;
                Session["HasLimitedShipProductInfo1"] = msgLimited1;
                Session["HasLimitedShipProductInfo2"] = msgLimited2;
                //msgLimited += " 属限运商品,请从购物车中删除! <a href='http://www.icson.com/Service/NewsDetail.aspx?Type=Bulletin&ID=35' target='_blank'>查看限运说明</a>";
            }
            else
            {
                Session["HasLimitedShipProduct"]      = "0";
                Session["HasLimitedShipProductInfo1"] = "";
                Session["HasLimitedShipProductInfo2"] = "";
            }

            //if (scArea.ProvinceSysNo != 1 && scArea.ProvinceSysNo != 1591 && scArea.ProvinceSysNo != 3225 && scArea.ProvinceSysNo != 2621)
            //{
            //    if (msgLimited.Length > 0)
            //    {
            //        lblErrMsg.Text = msgLimited;
            //        return;
            //    }
            //}

            //是否是新增地址状态
            if (ddlAddresses.SelectedValue == "create")
            {
                ////将原来的默认地址取消默认
                //oldAddress.IsDefault = -1;
                //CustomerManager.GetInstance().UpdateCustomerAddress();

                //新地址保存
                CustomerAddressInfo o = new CustomerAddressInfo();
                o.CustomerSysNo = oSession.sCustomer.SysNo;
                o.Brief         = txtBrief.Text.Trim();
                o.Name          = txtName.Text.Trim();
                o.Contact       = txtContact.Text.Trim();
                o.Address       = txtAddress.Text.Trim();
                o.AreaSysNo     = scArea.AreaSysNo;
                o.Phone         = txtPhone.Text.Trim();
                o.CellPhone     = txtCellPhone.Text.Trim();
                o.Zip           = txtZip.Text.Trim();
                o.Fax           = txtFax.Text.Trim();
                o.IsDefault     = (int)AppEnum.BiStatus.InValid;
                o.UpdateTime    = DateTime.Now;

                if (lblSysNo.Text.Trim() == "")//原来没有默认地址,就将新增的设置为默认地址
                {
                    o.IsDefault = 0;
                }

                CustomerManager.GetInstance().InsertCustomerAddress(o);

                //新地址存入当前用户信息
                oSession.sSO = new SOInfo();
                oSession.sSO.CustomerSysNo    = o.CustomerSysNo;
                oSession.sSO.ReceiveAddress   = o.Address;
                oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
                oSession.sSO.ReceiveCellPhone = o.CellPhone;
                oSession.sSO.ReceiveContact   = o.Contact;
                oSession.sSO.ReceiveName      = o.Name;
                oSession.sSO.ReceivePhone     = o.Phone;
                oSession.sSO.ReceiveZip       = o.Zip;

                Response.Redirect("CheckOut4.aspx");
            }
            else
            {
                int sysno             = Int32.Parse(ddlAddresses.SelectedValue);
                CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
                o.Brief     = txtBrief.Text.Trim();
                o.Name      = txtName.Text.Trim();
                o.Contact   = txtContact.Text.Trim();
                o.Address   = txtAddress.Text.Trim();
                o.AreaSysNo = scArea.AreaSysNo;
                o.Phone     = txtPhone.Text.Trim();
                o.CellPhone = txtCellPhone.Text.Trim();
                o.Zip       = txtZip.Text.Trim();
                o.Fax       = txtFax.Text.Trim();
                CustomerManager.GetInstance().UpdateCustomerAddress(o);

                oSession.sSO = new SOInfo();
                oSession.sSO.CustomerSysNo    = o.CustomerSysNo;
                oSession.sSO.ReceiveAddress   = o.Address;
                oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
                oSession.sSO.ReceiveCellPhone = o.CellPhone;
                oSession.sSO.ReceiveContact   = o.Contact;
                oSession.sSO.ReceiveName      = o.Name;
                oSession.sSO.ReceivePhone     = o.Phone;
                oSession.sSO.ReceiveZip       = o.Zip;

                Response.Redirect("CheckOut.aspx");
            }


            //if(lblSysNo.Text == "0")
            //{
            //    CustomerAddressInfo o = new CustomerAddressInfo();
            //    o.CustomerSysNo = oSession.sCustomer.SysNo;
            //    o.Brief = txtBrief.Text.Trim();
            //    o.Name = txtName.Text.Trim();
            //    o.Contact = txtContact.Text.Trim();
            //    o.Address = txtAddress.Text.Trim();
            //    o.AreaSysNo = scArea.AreaSysNo;
            //    o.Phone = txtPhone.Text.Trim();
            //    o.CellPhone = txtCellPhone.Text.Trim();
            //    o.Zip = txtZip.Text.Trim();
            //    o.Fax = txtFax.Text.Trim();
            //    o.IsDefault = (int) AppEnum.BiStatus.InValid;
            //    o.UpdateTime = DateTime.Now;
            //    CustomerManager.GetInstance().InsertCustomerAddress(o);

            //    oSession.sSO = new SOInfo();
            //    oSession.sSO.CustomerSysNo = o.CustomerSysNo;
            //    oSession.sSO.ReceiveAddress = o.Address;
            //    oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
            //    oSession.sSO.ReceiveCellPhone = o.CellPhone;
            //    oSession.sSO.ReceiveContact = o.Contact;
            //    oSession.sSO.ReceiveName = o.Name;
            //    oSession.sSO.ReceivePhone = o.Phone;
            //    oSession.sSO.ReceiveZip = o.Zip;

            //    Response.Redirect("CheckOut2.aspx");
            //}
            //else
            //{
            //    foreach (DataListItem item in DataList1.Items)
            //    {
            //        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem)
            //        {
            //            ImageButton imgbtn = item.FindControl("btnSelect") as ImageButton;
            //            if (imgbtn.ImageUrl == "../Images/site/SelectedIcon.jpg")
            //            {
            //                int sysno = Int32.Parse(DataList1.DataKeys[item.ItemIndex].ToString());
            //                CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
            //                o.Brief = txtBrief.Text.Trim();
            //                o.Name = txtName.Text.Trim();
            //                o.Contact = txtContact.Text.Trim();
            //                o.Address = txtAddress.Text.Trim();
            //                o.AreaSysNo = scArea.AreaSysNo;
            //                o.Phone = txtPhone.Text.Trim();
            //                o.CellPhone = txtCellPhone.Text.Trim();
            //                o.Zip = txtZip.Text.Trim();
            //                o.Fax = txtFax.Text.Trim();
            //                CustomerManager.GetInstance().UpdateCustomerAddress(o);

            //                oSession.sSO = new SOInfo();
            //                oSession.sSO.CustomerSysNo = o.CustomerSysNo;
            //                oSession.sSO.ReceiveAddress = o.Address;
            //                oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
            //                oSession.sSO.ReceiveCellPhone = o.CellPhone;
            //                oSession.sSO.ReceiveContact = o.Contact;
            //                oSession.sSO.ReceiveName = o.Name;
            //                oSession.sSO.ReceivePhone = o.Phone;
            //                oSession.sSO.ReceiveZip = o.Zip;

            //                Response.Redirect("CheckOut2.aspx");
            //                break;
            //            }
            ////        }
            //    }

            //    //没有默认的收获地址,新增的一个设为默认
            //    CustomerAddressInfo o2 = new CustomerAddressInfo();
            //    o2.CustomerSysNo = oSession.sCustomer.SysNo;
            //    o2.Brief = txtBrief.Text.Trim();
            //    o2.Name = txtName.Text.Trim();
            //    o2.Contact = txtContact.Text.Trim();
            //    o2.Address = txtAddress.Text.Trim();
            //    o2.AreaSysNo = scArea.AreaSysNo;
            //    o2.Phone = txtPhone.Text.Trim();
            //    o2.CellPhone = txtCellPhone.Text.Trim();
            //    o2.Zip = txtZip.Text.Trim();
            //    o2.Fax = txtFax.Text.Trim();
            //    o2.IsDefault = (int)AppEnum.BiStatus.Valid;
            //    o2.UpdateTime = DateTime.Now;
            //    CustomerManager.GetInstance().InsertCustomerAddress(o2);

            //    oSession.sSO = new SOInfo();
            //    oSession.sSO.CustomerSysNo = o2.CustomerSysNo;
            //    oSession.sSO.ReceiveAddress = o2.Address;
            //    oSession.sSO.ReceiveAreaSysNo = o2.AreaSysNo;
            //    oSession.sSO.ReceiveCellPhone = o2.CellPhone;
            //    oSession.sSO.ReceiveContact = o2.Contact;
            //    oSession.sSO.ReceiveName = o2.Name;
            //    oSession.sSO.ReceivePhone = o2.Phone;
            //    oSession.sSO.ReceiveZip = o2.Zip;

            //    Response.Redirect("CheckOut2.aspx");
            //}
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     rtq = new RTQManager();
     serv = new ServicesManager();
     cs = new CustomerManager();
 }
Exemplo n.º 44
0
 public ModifyClientViewModel(ShellViewModel shellViewModel)
 {
     MainWindow      = shellViewModel;
     customerManager = new CustomerManager();
     ClientProps     = new BindableCollection <string>(customerManager.GetProps());
 }
Exemplo n.º 45
0
 protected void Page_Load(object sender, EventArgs e)
 {
     cs = new CustomerManager();
     rtq = new RTQManager();
     person = null;
     address = null;
     customer = null;
     invoice = null;
     q = null;
 }
Exemplo n.º 46
0
 public void Add(Customer cus)
 {
     CustomerManager.getInstance().AddCustomer(cus);
 }
 public static bool DeleteCustomerFollowupAction(int customerFollowupActionId)
 {
     bool result = true;
     using (CustomerManager customerManager = new CustomerManager(null))
     {
         try
         {
             customerManager.DeleteCustomerFollowUpAction(customerManager.GetCustomerFollowupAction(customerFollowupActionId));
         }
         catch (System.Data.SqlClient.SqlException e)
         {
             result = false;
         }
     }
     return result;
 }
Exemplo n.º 48
0
 public String Remove(String registrationNumber)
 {
     return(CustomerManager.getInstance().RemoveCustomer(registrationNumber));
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     rtq = new RTQManager();
     sales = new SalesManager();
     serv = new ServicesManager();
     customer = new CustomerManager();
     de = new DynamicElements();
 }
Exemplo n.º 50
0
 public CustomerController()
 {
     CManager = new CustomerManager(new UnitOfWork(new DataContext("test")));
     OManager = new OrderManager(new UnitOfWork(new DataContext("test")));
 }