Example #1
0
        private IQueryable <BuySellDoc> getAllPurchaseOrders_For(string userId)
        {
            //we need to be able to get all the purchase orders here without the userid
            //userId.IsNullOrWhiteSpaceThrowArgumentException("You are not logged in.");


            //when selling, the user is the owner
            IQueryable <BuySellDoc> purchaseOrdersIq = FindAll();

            if (userId.IsNullOrWhiteSpace())
            {
                return(purchaseOrdersIq);
            }
            Customer customer;

            try
            {
                customer = CustomerBiz.GetPlayerFor(userId);
                customer.IsNullThrowException("Customer");
            }
            catch (Exception e)
            {
                ErrorsGlobal.Add("No Owner is attached", MethodBase.GetCurrentMethod(), e);
                throw new Exception(ErrorsGlobal.ToString());
            }


            //get all purchase orders for Owner
            purchaseOrdersIq = purchaseOrdersIq
                               .Where(x => x.CustomerId == customer.Id);

            return(purchaseOrdersIq);
        }
Example #2
0
        private Customer getCustomerOfUser()
        {
            Customer customerUser = CustomerBiz.GetPlayerFor(UserId);

            customerUser.IsNullThrowException("Unable to get customer for user.");
            return(customerUser);
        }
Example #3
0
        /// <summary>
        /// this only fires once user has accepted to move on
        /// </summary>
        /// <param name="buySellDoc"></param>
        private void update_Customer_Person_Bill_To_Default_Address_If_empty(BuySellDoc buySellDoc)
        {
            buySellDoc.IsNullThrowException();
            buySellDoc.CustomerId.IsNullOrWhiteSpaceThrowException();
            buySellDoc.AddressBillToId.IsNullOrWhiteSpaceThrowException();
            Person customerPerson = CustomerBiz.GetPersonForPlayer(buySellDoc.CustomerId);

            customerPerson.IsNullThrowException();

            if (customerPerson.DefaultBillAddressId.IsNullOrEmpty())
            {
                customerPerson.DefaultBillAddressId = buySellDoc.AddressBillToId;
                PersonBiz.Update(customerPerson);
            }

            //Now update the Customer Default Address if required.
            //get the customer.
            Customer customer = buySellDoc.Customer;

            if (customer.IsNull())
            {
                buySellDoc.CustomerId.IsNullOrWhiteSpaceThrowException();
                customer = CustomerBiz.Find(buySellDoc.CustomerId);
                customer.IsNullThrowException();

                if (customer.DefaultBillAddressId.IsNullOrWhiteSpace())
                {
                    customer.DefaultBillAddressId = customerPerson.DefaultBillAddressId;
                    CustomerBiz.Update(customer);
                }
            }
        }
Example #4
0
        private void Search(object sender, EventArgs e)
        {
            var biz = new CustomerBiz();

            dataGridView.DataSource = biz.SearchCustomerByName(textCustomerName.Text);
            dataGridView.Refresh();
        }
Example #5
0
 private void FillFormData()
 {
     try
     {
         hdCuId.Value = Request["cuid"];
         var entity = CustomerBiz.GetCuCustomerEntity(hdCuId.Value);
         if (entity != null)
         {
             txtCuId.Text      = entity.CuId;
             txtCuName.Text    = entity.CuName;
             txtDistrict.Text  = entity.District;
             txtAddress.Text   = entity.Address;
             txtRemark.Text    = entity.Remark;
             rEnabled.Checked  = (bool)entity.ActivityFlag;
             rDisabled.Checked = !(bool)entity.ActivityFlag;
         }
         else
         {
             btnAddNew.Enabled = false;
             txtCuId.Text      = "*后台自动生成*";
         }
         txtCuId.Enabled = false;
     }
     catch (Exception ex)
     {
         lMessage.Text = string.Format("数据加载失败,原因:{0}", ex.Message);
     }
 }
Example #6
0
 private void calculate_Customer_Payment(BuySellDoc bsd, PersonPayingPenalty ppp, decimal totalPaymentAmount)
 {
     ppp.From.Person = CustomerBiz.GetPersonForPlayer(bsd.CustomerId);
     ppp.From.Person.IsNullThrowException();
     ppp.From.Amount  = totalPaymentAmount;
     ppp.From.Comment = "Customer";
 }
Example #7
0
        private void RefreshItems(object sender, EventArgs e)
        {
            var biz = new CustomerBiz();

            radGridView.DataSource = biz.LoadItems();
            radGridView.Refresh();
        }
Example #8
0
        public string ApplyAccountNewRepaymentByCustomer(string InstallationID, string soapusername, string soappassword,
                                                         string CustomerID, string FacilityNo, string AccountNo,
                                                         string Newrepaymentdate, string NewRepaymentfrequency, string NewMinPaymentAmount, string NewNominateAmount, string NewAdditionalAmount)
        {
            try
            {
                CustomerBiz oBiz = new CustomerBiz(InstallationID, soapusername, soappassword, CustomerID, FacilityNo, AccountNo);

                DateTime newrepaymentdate    = Convert.ToDateTime(Newrepaymentdate);
                Decimal  newMinPaymentAmount = Convert.ToDecimal(NewMinPaymentAmount);
                Decimal? newNominateAmount   = null;
                if (NewNominateAmount != "")
                {
                    newNominateAmount = Convert.ToDecimal(NewNominateAmount);
                }
                Decimal newAdditionalAmount = Convert.ToDecimal(NewAdditionalAmount);

                FacilityByCustomerDAL fdal = new FacilityByCustomerDAL();
                DataSet myDataSet          = fdal.ApplyAccountNewRepaymentByCustomer(
                    oBiz.InstallationID, oBiz.CustomerID, oBiz.AccountFacilityID.Value, oBiz.AccountID.Value,
                    newrepaymentdate, NewRepaymentfrequency, newMinPaymentAmount, newNominateAmount, newAdditionalAmount);

                return(myDataSet.GetXml());
            }
            catch (Exception ex)
            {
                return("<error>" + LWTSafeTypes.SafeXml(ex.Message.ToString()) + "</error>");
            }
        }
Example #9
0
        public string GetAccountStatementListByCustomer(string InstallationID,
                                                        string soapusername, string soappassword,
                                                        string CustomerID, string FacilityNo, string AccountNo, string StartDate, string EndDate)
        {
            try
            {
                DateTime startDate, endDate;
                if (StartDate == "" || EndDate == "")
                {
                    throw new Exception("Missing Date range");
                }

                CustomerBiz oBiz = new CustomerBiz(InstallationID, soapusername, soappassword, CustomerID, FacilityNo, AccountNo);

                startDate = Convert.ToDateTime(StartDate);
                endDate   = Convert.ToDateTime(EndDate);

                DataSet myDataSet = (new FacilityByCustomerDAL()).GetAccountStatementListByCustomer(
                    oBiz.InstallationID, oBiz.CustomerID, oBiz.AccountFacilityID.Value, oBiz.AccountID.Value, startDate, endDate);
                return(myDataSet.GetXml());
            }
            catch (Exception ex)
            {
                return("<error>" + ex.Message.ToString() + "</error>");
            }
        }
Example #10
0
        public string CreateStatementByCustomer(string InstallationID,
                                                string soapusername, string soappassword,
                                                string CustomerID, string FacilityNo, string AccountNo, string StartDate, string EndDate)
        {
            try
            {
                DateTime startDate, endDate;

                if (StartDate == "" || EndDate == "")
                {
                    throw new Exception("Missing Date range");
                }

                CustomerBiz oBiz = new CustomerBiz(InstallationID, soapusername, soappassword, CustomerID, FacilityNo, AccountNo);
                startDate = Convert.ToDateTime(StartDate);
                endDate   = Convert.ToDateTime(EndDate);

                GenerateStatementBiz generateStatement = new GenerateStatementBiz();
                Int64 AccountTemplateDocumentID        = generateStatement.GenerateStatement(
                    Convert.ToInt64(InstallationID), Convert.ToInt64(FacilityNo), Convert.ToInt64(AccountNo), 0, startDate, endDate);

                return("<accountdocumentid>" + LWTSafeTypes.SafeString(AccountTemplateDocumentID) + "</accountdocumentid>");
            }
            catch (Exception ex)
            {
                return("<error>" + ex.Message.ToString() + "</error>");
            }
        }
Example #11
0
        private void RefreshItems()
        {
            var biz = new CustomerBiz();

            radGridView.DataSource = biz.LoadItems();
            radGridView.Refresh();
        }
Example #12
0
        //private decimal getAllOrder_InMoney_For(BuySellDocStateENUM buySellDocStateEnum, BuySellDocumentTypeENUM buySellDocumentTypeEnum, string userId, DateTime fromDate, DateTime toDate)
        //{

        //    //get all purchase orders for Owner
        //    List<BuySellDoc> purchaseOrdersLst = getAllPurchaseOrders_For(userId, buySellDocStateEnum);

        //    //add up the purchase amoung
        //    if (purchaseOrdersLst.IsNullOrEmpty())
        //        return 0;

        //    decimal totalPurchase = 0;
        //    foreach (var item in purchaseOrdersLst)
        //    {
        //        totalPurchase += item.TotalRemaining;
        //    }

        //    return totalPurchase;
        //}

        //private List<BuySellDoc> getAllDocuments_For(string userId, BuySellDocStateENUM buySellDocStateEnum)
        //{
        //    List<BuySellDoc> purchaseOrdersLst = new List<BuySellDoc>();
        //    switch (buySellDocStateEnum)
        //    {
        //        case BuySellDocStateENUM.New:
        //        case BuySellDocStateENUM.InProccess:
        //        case BuySellDocStateENUM.Closed:
        //        case BuySellDocStateENUM.BackOrdered:
        //        case BuySellDocStateENUM.Canceled:
        //        case BuySellDocStateENUM.Quotation:
        //        case BuySellDocStateENUM.Credit:
        //            purchaseOrdersLst = getAllPurchaseOrders_For(userId)
        //               .Where(x => x.BuySellDocStateEnum == buySellDocStateEnum)
        //               .ToList();
        //            break;
        //        case BuySellDocStateENUM.All:
        //            purchaseOrdersLst = getAllPurchaseOrders_For(userId)
        //               .Where(x =>
        //                   x.BuySellDocStateEnum == BuySellDocStateENUM.New ||
        //                   x.BuySellDocStateEnum == BuySellDocStateENUM.InProccess)
        //               .ToList();
        //            break;
        //        case BuySellDocStateENUM.Unknown:
        //        default:
        //            throw new Exception("State of document is unknown.");
        //    }
        //    //get all purchase orders for Owner
        //    return purchaseOrdersLst;
        //}



        #region General Methods



        private Customer getCustomerFor(string userId)
        {
            Customer customer = CustomerBiz.GetPlayerFor(userId);

            customer.IsNullThrowException("customer");
            return(customer);
        }
Example #13
0
        private void Search(object sender, EventArgs e)
        {
            dataGridViewDetail.Visible = false;

            var biz = new CustomerBiz();
            dataGridView.DataSource = biz.SearchCustomerByName(textCustomerName.Text);
            dataGridView.Refresh();
        }
Example #14
0
 public SaleOrderBiz(Repositry <BuySellDoc> entityDal, BizParameters bizParameters, OwnerBiz ownerBiz, CustomerBiz customerBiz, ProductBiz productBiz, BuySellDocBiz buySellDocBiz)
     : base(entityDal, bizParameters, ownerBiz, customerBiz, productBiz)
 {
     _ownerBiz     = ownerBiz;
     _customerBiz  = customerBiz;
     _productBiz   = productBiz;
     buySellDocBiz = _buySellDocBiz;
 }
Example #15
0
        private void SaveItem(object sender, EventArgs e)
        {
            if (CustomValidation())
            {
                var item = new Customer();
                item.FullName = textFullName.Text;
                item.Address1 = textAddress1.Text;
                item.Address2 = textAddress2.Text;
                item.City     = Convert.ToString(drlCity.SelectedItem);
                item.Segment  = Convert.ToString(drlSegment.SelectedItem);
                item.SMS      = textTenSms.Text;

                item.PostalCode = textPostalCode.Text;
                item.Tel        = textTel.Text;
                item.Mobile1    = textMobile1.Text;
                item.Mobile2    = textMobile2.Text;
                item.Email1     = textEmail1.Text;
                item.Email2     = textEmail2.Text;
                if (!string.IsNullOrEmpty(numberDelivery.Text))
                {
                    item.Delivery = Convert.ToInt32(numberDelivery.Text);
                }
                item.OtherInformation = textOtherInformation.Text;
                item.Company          = txtCompany.Text;
                item.Mst = textMst.Text;

                if (itemId > 0)
                {
                    item.Id              = itemId;
                    item.Created         = created;
                    item.CreatedByUserId = createdBy;

                    item.Modified         = DateTime.Now;
                    item.ModifiedByUserId = currentUser;

                    var biz = new CustomerBiz();
                    biz.UpdateItem(item);
                }
                else
                {
                    item.Created         = DateTime.Now;
                    item.CreatedByUserId = currentUser;

                    item.Modified         = DateTime.Now;
                    item.ModifiedByUserId = currentUser;

                    var biz = new CustomerBiz();
                    biz.SaveItem(item);
                }

                this.Close();
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }
        }
Example #16
0
 private void LoadCustomer()
 {
     var biz = new CustomerBiz();
     var items = biz.LoadAllCustomerName();
     AutoCompleteStringCollection list = new AutoCompleteStringCollection();
     list.AddRange(items.ToArray());
     textCustomerName.AutoCompleteCustomSource = null;
     textCustomerName.AutoCompleteCustomSource = list;
 }
Example #17
0
        private void LoadCustomer()
        {
            var biz   = new CustomerBiz();
            var items = biz.LoadAllCustomerName();
            AutoCompleteStringCollection list = new AutoCompleteStringCollection();

            list.AddRange(items.ToArray());
            textSearchCustomer.AutoCompleteCustomSource = null;
            textSearchCustomer.AutoCompleteCustomSource = list;
        }
Example #18
0
        public List <BuySellDoc> SalesOrderFor(string userId)
        {
            Customer customer = CustomerBiz.GetEntityFor(UserId);

            customer.IsNullThrowException("Customer");

            List <BuySellDoc> salesOrderList = FindAll().Where(x => x.CustomerId == customer.Id).ToList();

            return(salesOrderList);
        }
Example #19
0
        private void LoadCustomer()
        {
            var biz = new CustomerBiz();
            var items = biz.LoadItems();
            items.Insert(0, new Customer());

            drlCustomer.Items.Clear();
            drlCustomer.DataSource = items;
            drlCustomer.DisplayMember = "FullName";
            drlCustomer.ValueMember = "Id";
        }
Example #20
0
        public FindCustomer(string name)
        {
            InitializeComponent();

            dataGridView.AutoGenerateColumns = false;

            textCustomerName.Text = name;

            var biz = new CustomerBiz();
            dataGridView.DataSource = biz.SearchCustomerByName(name);
            dataGridView.Refresh();
        }
Example #21
0
        private void LoadCustomer()
        {
            var biz   = new CustomerBiz();
            var items = biz.LoadItems();

            items.Insert(0, new Customer());

            drlCustomer.Items.Clear();
            drlCustomer.DataSource    = items;
            drlCustomer.DisplayMember = "FullName";
            drlCustomer.ValueMember   = "Id";
        }
Example #22
0
        protected void btnChangeCustomerPassword_OnClick(object sender, EventArgs e)
        {
            objCustomer    = new Customer();
            objCustomerBiz = new CustomerBiz();

            //objCustomer.CustomerUsername = ViewState["CustomerUsername"].ToString();
            objCustomer.CustomerUsername = txtGetuserNameForPasswordChange.Text.Trim();
            objCustomer.CustomerPassword = SHA512PasswordGenerator(txtUpdateCustomerPassword.Text.Trim());
            objCustomer.UpdatedBy        = Convert.ToInt16(Session["UserId"]);

            objCustomerBiz.ChangeCustomerPasswordByAdmin(objCustomer);
        }
Example #23
0
        public CustomerView(User user)
        {
            InitializeComponent();

            var biz = new CustomerBiz();
            radGridView.DataSource = biz.LoadItems();
            radGridView.Refresh();

            _currentUser = user;

            buttonSelectItems.Text = "Chọn";
        }
Example #24
0
        public FindCustomer(string name)
        {
            InitializeComponent();

            dataGridView.AutoGenerateColumns = false;

            textCustomerName.Text = name;

            var biz = new CustomerBiz();

            dataGridView.DataSource = biz.SearchCustomerByName(name);
            dataGridView.Refresh();
        }
Example #25
0
 private void fixCustomer(BuySellDoc buySellDoc)
 {
     //do we want to allow empty orders??
     if (buySellDoc.CustomerId.IsNullOrWhiteSpace())
     {
         buySellDoc.CustomerId = null;
     }
     else
     {
         buySellDoc.Customer = CustomerBiz.Find(buySellDoc.CustomerId);
         buySellDoc.Customer.IsNullThrowException("Customer not found!");
     }
 }
Example #26
0
        public CustomerView(User user)
        {
            InitializeComponent();

            var biz = new CustomerBiz();

            radGridView.DataSource = biz.LoadItems();
            radGridView.Refresh();

            _currentUser = user;

            buttonSelectItems.Text = "Chọn";
        }
Example #27
0
 public string GetSecurityDetailByCustomer(string InstallationID, string soapusername, string soappassword, string CustomerID, string FacilityNo, string AccountNo)
 {
     try
     {
         CustomerBiz oBiz      = new CustomerBiz(InstallationID, soapusername, soappassword, CustomerID, FacilityNo, "");
         DataSet     myDataSet = (new FacilityByCustomerDAL()).GetSecurityDetailByCustomer(
             oBiz.InstallationID, oBiz.CustomerID, oBiz.AccountFacilityID.Value);
         return(myDataSet.GetXml());
     }
     catch (Exception ex)
     {
         return("<error>" + LWTSafeTypes.SafeXml(ex.Message.ToString()) + "</error>");
     }
 }
Example #28
0
        public string GetCustomerDetails(string InstallationID, string soapusername, string soappassword, string CustomerID)
        {
            try
            {
                CustomerBiz oBiz      = new CustomerBiz(InstallationID, soapusername, soappassword, CustomerID, "", "");
                DataSet     myDataSet = (new FacilityByCustomerDAL()).GetCustomerDetails(oBiz.CustomerID);

                return(myDataSet.GetXml());
            }
            catch (Exception ex)
            {
                return("<error>" + LWTSafeTypes.SafeXml(ex.Message.ToString()) + "</error>");
            }
        }
Example #29
0
        public CustomerForm(int id, User user)
        {
            InitializeComponent();
            InitForm(user);

            textFullName.Focus();
            itemId = id;

            var biz = new CustomerBiz();
            var item = biz.LoadItem(id);

            textFullName.Text = item.FullName;
            textAddress1.Text = item.Address1;
            textAddress2.Text = item.Address2;
            textPostalCode.Text = item.PostalCode;
            textTel.Text = item.Tel;
            textMobile1.Text = item.Mobile1;
            textMobile2.Text = item.Mobile2;
            textEmail1.Text = item.Email1;
            textEmail2.Text = item.Email2;
            drlSegment.SelectedItem = item.Segment;
            txtCompany.Text = item.Company;
            textMst.Text = item.Mst;

            textTenSms.Text = item.SMS;

            if (item.Delivery.HasValue)
            {
                numberDelivery.Text = Convert.ToString(item.Delivery.Value);
            }
            textOtherInformation.Text = item.OtherInformation;

            foreach(string city in drlCity.Items)
            {
                if(string.Equals(city, item.City, StringComparison.InvariantCultureIgnoreCase))
                {
                    drlCity.SelectedItem = city;
                    break;
                }
            }

            created = item.Created;
            createdBy = item.CreatedByUserId;
            modified = item.Modified;
            modifiedBy = item.ModifiedByUserId;

            buttonViewOrder.Visible = true;

            this.Text = "Sửa khách hàng";
        }
Example #30
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            Customer Obj_Add_Customer = new Customer
            {
                Name       = txtName.Text,
                Age        = txtAge.Text,
                Email      = txtEmail.Text,
                RateListID = Convert.ToInt32(ddl_RateList.SelectedValue),
                WineID     = Convert.ToInt32(ddl_Wine.SelectedValue),
            };

            CustomerBiz.SaveCustomers(Obj_Add_Customer);
            Customer_Fill();
        }
Example #31
0
        public CustomerForm(int id, User user)
        {
            InitializeComponent();
            InitForm(user);

            textFullName.Focus();
            itemId = id;

            var biz  = new CustomerBiz();
            var item = biz.LoadItem(id);

            textFullName.Text       = item.FullName;
            textAddress1.Text       = item.Address1;
            textAddress2.Text       = item.Address2;
            textPostalCode.Text     = item.PostalCode;
            textTel.Text            = item.Tel;
            textMobile1.Text        = item.Mobile1;
            textMobile2.Text        = item.Mobile2;
            textEmail1.Text         = item.Email1;
            textEmail2.Text         = item.Email2;
            drlSegment.SelectedItem = item.Segment;
            txtCompany.Text         = item.Company;
            textMst.Text            = item.Mst;

            textTenSms.Text = item.SMS;

            if (item.Delivery.HasValue)
            {
                numberDelivery.Text = Convert.ToString(item.Delivery.Value);
            }
            textOtherInformation.Text = item.OtherInformation;

            foreach (string city in drlCity.Items)
            {
                if (string.Equals(city, item.City, StringComparison.InvariantCultureIgnoreCase))
                {
                    drlCity.SelectedItem = city;
                    break;
                }
            }

            created    = item.Created;
            createdBy  = item.CreatedByUserId;
            modified   = item.Modified;
            modifiedBy = item.ModifiedByUserId;

            buttonViewOrder.Visible = true;

            this.Text = "Sửa khách hàng";
        }
Example #32
0
        private void ViewCustomer(int id)
        {
            var biz  = new CustomerBiz();
            var data = biz.SearchCustomer(id);

            if (data != null && data.Count > 0)
            {
                dataGridViewDetail.Visible = true;

                dataGridViewDetail.DataSource = null;
                dataGridViewDetail.DataSource = data;
                dataGridViewDetail.Refresh();
            }
        }
Example #33
0
        private void GridViewBindCustomerInfo()
        {
            objCustomer    = new Customer();
            objCustomerBiz = new CustomerBiz();
            DataTable dtCustomer = new DataTable();

            dtCustomer = objCustomerBiz.GetCustomerInfoForGv(txtCustomerUsername.Text.Trim());
            gvDisplayCustomerInfo.DataSource = dtCustomer;
            gvDisplayCustomerInfo.DataBind();
            gvDisplayCustomerInfo.ShowHeaderWhenEmpty           = true;
            gvDisplayCustomerInfo.EmptyDataText                 = "No Data Found";
            gvDisplayCustomerInfo.AlternatingRowStyle.BackColor = System.Drawing.Color.AliceBlue;
            gvDisplayCustomerInfo.SelectedRowStyle.BackColor    = System.Drawing.Color.DarkKhaki;
        }
Example #34
0
        public DataSet GetSecurityQuestionList(CustomerBiz oCust)
        {
            try
            {
                DbCommand DbCommand = database.GetStoredProcCommand("lmsCustomerPortal_GetSecurityQuestionList");
                database.AddInParameter(DbCommand, "@InstallationID", DbType.Int32, oCust.InstallationID);

                return(InternalExecuteDataSet(database, DbCommand, null));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #35
0
        public string GetSecurityQuestionList(string InstallationID, string soapusername, string soappassword)
        {
            try
            {
                CustomerBiz oBiz = new CustomerBiz(soapusername, soappassword);

                DataSet myDataSet = oBiz.GetSecurityQuestionList(InstallationID);

                return(myDataSet.GetXml());
            }
            catch (Exception ex)
            {
                return("<error>" + LWTSafeTypes.SafeXml(ex.Message.ToString()) + "</error>");
            }
        }
Example #36
0
        public void LoadSelectListsFor_GET(BuySellDoc buySellDoc)
        {
            buySellDoc.SelectListCustomer            = CustomerBiz.SelectList();
            buySellDoc.SelectListOwner               = OwnerBiz.SelectList();
            buySellDoc.SelectListAddressInformTo     = AddressBiz.SelectListInformAddressFor(UserId);
            buySellDoc.SelectListAddressShipTo       = AddressBiz.SelectListShipAddressFor(UserId);
            buySellDoc.SelectListVehicalTypeAccepted = VehicalTypeBiz.SelectList();

            load_VehicalTypeRequested_SelectList_Into_BuySellDoc(buySellDoc);
            load_VehicalTypeOffered_SelectList_Into_BuySellDoc(buySellDoc);
            load_Deliverymen_SelectList_Into_BuySellDoc(buySellDoc);
            load_Freight_Request_Into_String_Field(buySellDoc);
            load_ShipAddress_SelectList_Into_BuySellDoc(buySellDoc);
            load_Salesmen_SelectList_Into_BuySellDoc(buySellDoc);
        }
Example #37
0
        private void DeleteItem(object sender, EventArgs e)
        {
            var items = new List<Customer>();

            foreach (var row in radGridView.Rows)
            {
                if (row.Cells[0].Value != null && Convert.ToBoolean(row.Cells[0].Value))
                {
                    items.Add(row.DataBoundItem as Customer);
                }
            }

            var biz = new CustomerBiz();
            biz.RemoveItem(items);

            RefreshItems(sender, e);
        }
Example #38
0
        private void SelectCustomer(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count > 0)
            {
                int index = dataGridView.SelectedRows[0].Index;
                var customer = dataGridView.SelectedRows[0].DataBoundItem as Customer;

                if(customer != null)
                {
                    var biz = new CustomerBiz();
                    var data = biz.SearchCustomer(customer.Id);

                    if(data != null && data.Count > 0)
                    {
                        dataGridViewDetail.Visible = true;

                        dataGridViewDetail.DataSource = null;
                        dataGridViewDetail.DataSource = data;
                        dataGridViewDetail.Refresh();
                    }
                }
            }
        }
Example #39
0
        public SearchCustomer(User user, string condition, bool isShowResult = false, int id = 0)
        {
            InitializeComponent();

            dataGridViewDetail.Visible = false;
            dataGridViewDetail.AutoGenerateColumns = false;
            dataGridView.AutoGenerateColumns = false;

            textCustomerName.Text = condition;

            var biz = new CustomerBiz();
            dataGridView.DataSource = biz.SearchCustomerByName(condition);
            dataGridView.Refresh();

            _currentUser = user;

            LoadCustomer();

            if(isShowResult)
            {
                ViewCustomer(id);
            }
        }
Example #40
0
        private void ViewCustomer(int id)
        {
            var biz = new CustomerBiz();
            var data = biz.SearchCustomer(id);

            if (data != null && data.Count > 0)
            {
                dataGridViewDetail.Visible = true;

                dataGridViewDetail.DataSource = null;
                dataGridViewDetail.DataSource = data;
                dataGridViewDetail.Refresh();
            }
        }
Example #41
0
 private void RefreshItems(object sender, EventArgs e)
 {
     var biz = new CustomerBiz();
     radGridView.DataSource = biz.LoadItems();
     radGridView.Refresh();
 }
Example #42
0
        private void ExportDataSet(string fileName)
        {
            var biz = new CustomerBiz();

            using (var document = SpreadsheetDocument.Open(fileName, false))
            {
                var wbPart = document.WorkbookPart;
                Sheet theSheet = wbPart.Workbook.Descendants<Sheet>().FirstOrDefault();

                var wsPart = (WorksheetPart)(wbPart.GetPartById(theSheet.Id));
                var customerListing = new List<CustomerItem>();
                for (var i = 2; i <= wsPart.Worksheet.Descendants<Row>().Count(); i++)
                {
                    int number = 0;
                    var item = new Customer
                    {
                        SMS = IOReader.GetCellValue(document, theSheet, "B" + i),
                        FullName = IOReader.GetCellValue(document, theSheet, "C" + i),
                        Mst = IOReader.GetCellValue(document, theSheet, "D" + i),
                        Company = IOReader.GetCellValue(document, theSheet, "E" + i),
                        Address1 = IOReader.GetCellValue(document, theSheet, "F" + i),
                        Address2 = IOReader.GetCellValue(document, theSheet, "G" + i),
                        City = IOReader.GetCellValue(document, theSheet, "H" + i),
                        PostalCode = IOReader.GetCellValue(document, theSheet, "I" + i),
                        Tel = IOReader.GetCellValue(document, theSheet, "J" + i),
                        Mobile1 = IOReader.GetCellValue(document, theSheet, "K" + i),
                        Mobile2 = IOReader.GetCellValue(document, theSheet, "L" + i),
                        Email1 = IOReader.GetCellValue(document, theSheet, "M" + i),
                        Email2 = IOReader.GetCellValue(document, theSheet, "N" + i),
                        OtherInformation = IOReader.GetCellValue(document, theSheet, "P" + i),
                        Segment = IOReader.GetCellValue(document, theSheet, "Q" + i),
                    };

                    var delivery = IOReader.GetCellValue(document, theSheet, "O" + i);
                    if (!string.IsNullOrEmpty(delivery) && int.TryParse(delivery, out number))
                    {
                        item.Delivery = number;
                    }

                    if (!string.IsNullOrEmpty(item.FullName))
                    {
                        biz.SaveItem(item);
                    }
                }
            }
        }
Example #43
0
 private void RefreshItems()
 {
     var biz = new CustomerBiz();
     radGridView.DataSource = biz.LoadItems();
     radGridView.Refresh();
 }
Example #44
0
        private void SaveItem(object sender, EventArgs e)
        {
            if (CustomValidation())
            {
                var item = new Customer();
                item.FullName = textFullName.Text;
                item.Address1 = textAddress1.Text;
                item.Address2 = textAddress2.Text;
                item.City = Convert.ToString(drlCity.SelectedItem);
                item.Segment = Convert.ToString(drlSegment.SelectedItem);
                item.SMS = textTenSms.Text;

                item.PostalCode = textPostalCode.Text;
                item.Tel = textTel.Text;
                item.Mobile1 = textMobile1.Text;
                item.Mobile2 = textMobile2.Text;
                item.Email1 = textEmail1.Text;
                item.Email2 = textEmail2.Text;
                if (!string.IsNullOrEmpty(numberDelivery.Text))
                {
                    item.Delivery = Convert.ToInt32(numberDelivery.Text);
                }
                item.OtherInformation = textOtherInformation.Text;
                item.Company = txtCompany.Text;
                item.Mst = textMst.Text;

                if (itemId > 0)
                {
                    item.Id = itemId;
                    item.Created = created;
                    item.CreatedByUserId = createdBy;

                    item.Modified = DateTime.Now;
                    item.ModifiedByUserId = currentUser;

                    var biz = new CustomerBiz();
                    biz.UpdateItem(item);
                }
                else
                {
                    item.Created = DateTime.Now;
                    item.CreatedByUserId = currentUser;

                    item.Modified = DateTime.Now;
                    item.ModifiedByUserId = currentUser;

                    var biz = new CustomerBiz();
                    biz.SaveItem(item);
                }

                this.Close();
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }
        }