private void Remove(List <PfCustomer> list, PfCustomer item)
        {
            InteractResult result = PfCustomerCache.PfCustomer_OnRemove(item.ID);

            switch (result.ExeResult)
            {
            case ExeResult.Success:
                TreeModel treeM = new TreeModel();
                treeM.ID   = item.ID;
                treeM.Name = item.Name;
                CommonGlobalCache.DeletePFDistributor(treeM);
                GlobalMessageBox.Show("删除成功!");
                this.dataGridView1.DataSource = null;
                list.Remove(item);
                this.dataGridView1.DataSource = list;
                break;

            case ExeResult.Error:
                GlobalMessageBox.Show(result.Msg);
                break;

            default:
                break;
            }
        }
Example #2
0
 private void SaveOffLineCustomerForm_ConfirmClick(PfCustomer item, SaveOffLineCustomerForm form)
 {
     this.RefreshPage();
     //try
     //{
     //    if (GlobalUtil.EngineUnconnectioned(this))
     //    {
     //        return;
     //    }
     //    InteractResult result = GlobalCache.ServerProxy.InsertPfCustomer(item);
     //    switch (result.ExeResult)
     //    {
     //        case ExeResult.Success:
     //            PfCustomerCache.InsertPfCustomer(item);
     //            form.DialogResult = DialogResult.OK;
     //            this.RefreshPage();
     //            break;
     //        case ExeResult.Error:
     //            GlobalMessageBox.Show(result.Msg);
     //            form.Cancel();
     //            break;
     //        default:
     //            break;
     //    }
     //}
     //catch (Exception ex)
     //{
     //    GlobalUtil.ShowError(ex);
     //}
     //finally
     //{
     //    GlobalUtil.UnLockPage(this);
     //}
 }
        private void BaseButton_AddCostume_Click(object sender, EventArgs e)
        {
            try
            {
                int buyCount = int.Parse(this.skinTextBox_bugCount.SkinTxt.Text);
                PfCustomerRetailDetail detail = new PfCustomerRetailDetail()
                {
                    PfCustomerID   = pfCustomer.ID,
                    PfCustomerName = PfCustomerCache.GetPfCustomerName(pfCustomer.ID),
                    CostumeID      = this.currentSelectedItem.Costume.ID,
                    CostumeName    = this.currentSelectedItem.Costume.Name,
                    ColorName      = this.skinComboBox_Color.Text,
                    SizeName       = ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue),
                    // 显示自己设置的尺码组和对应的尺码列表
                    SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), CommonGlobalCache.GetSizeGroup(this.currentSelectedItem.Costume.SizeGroupName)),
                    BuyCount        = buyCount,
                };

                if (!this.AddSelectedCostumeToList(detail))
                {
                    return;
                }
                dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(this.PfCustomerRetailDetailList));
                lastAddCustomer = pfCustomer;
                this.skinTextBox_bugCount.SkinTxt.Text = "1";
            }
            catch (Exception ee)
            {
                CommonGlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("添加失败!");
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
            {
                return;
            }
            try
            {
                if (e.RowIndex > -1 && e.ColumnIndex > -1)
                {
                    DataGridView      view = (DataGridView)sender;
                    List <PfCustomer> list = (List <PfCustomer>)view.DataSource;
                    PfCustomer        item = (PfCustomer)list[e.RowIndex];
                    switch (view.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)
                    {
                    case "查询":
                        ShowForm(item);
                        break;

                    default: break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }
Example #5
0
        public static string GetUserNameWithPf(string userID)
        {
            String value = userID;

            if (value == SystemDefault.WithoutID)
            {
                value = SystemDefault.WithoutName;
            }
            else
            {
                PfCustomer guide = pfCustomerList?.Find(t => t.ID == userID);
                if (guide != null)
                {
                    value = guide.Name;
                }
                else
                {
                    AdminUser adminUser = adminUserList?.Find(t => t.ID == userID);
                    if (adminUser != null)
                    {
                        value = adminUser.Name;
                    }
                }
            }

            return(value);
        }
Example #6
0
        public void ShowDialog(PfCustomer PfCustomer)
        {
            this.skinLabelSupplier.Text = PfCustomer.Name;
            try
            {
                if (
                    CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                PfCostumeStoreInfo PfCustomerAccountRecordDetailInfo = GlobalCache.ServerProxy.GetPfCostumeStoreInfo(PfCustomer.ID);
                if (PfCustomerAccountRecordDetailInfo != null)
                {
                    skinLabelStore.Text = PfCustomerAccountRecordDetailInfo.Count.ToString();
                    skinLabelCost.Text  = PfCustomerAccountRecordDetailInfo.Money.ToString();
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
                this.TopMost = true;
                this.Show();
                this.TopMost = false;
            }
        }
 internal void Search(PfCustomer e)
 {
     this.textBoxCustomer.SelectedValue = e.ID;
     // this.pagePara.PfCustomerID = e.ID;
     CommonGlobalUtil.DateTime_All(dateTimePicker_Start, dateTimePicker_End);
     this.BaseButton_Search_Click(null, null);
 }
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
         {
             return;
         }
         if (e.RowIndex < 0 || e.ColumnIndex < 0)
         {
             return;
         }
         DataGridView view = sender as DataGridView;
         PfCustomer   item = view.Rows[e.RowIndex].DataBoundItem as PfCustomer;
         if (ColumnEdit.Index == e.ColumnIndex)
         {
             //修改
             Edit(item);
         }
     }
     catch (Exception ex)
     {
         GlobalUtil.ShowError(ex);
     }
 }
 public WholesaleAccountRecordReceivedForm(PfCustomer customer, decimal sumPfMoney)
 {
     InitializeComponent();
     this.customer   = customer;
     this.sumPfMoney = sumPfMoney;
     Initialize();
 }
        private PfCustomer Build()
        {
            PfCustomer customer = new PfCustomer();


            customer.ID                = this.skinTextBoxID.SkinTxt.Text.Trim();
            customer.FirstCharSpell    = DisplayUtil.GetPYString(this.skinTextBoxName.SkinTxt.Text.Trim());
            customer.Name              = this.skinTextBoxName.SkinTxt.Text.Trim();
            customer.Contact           = this.skinTextBox_Contact.SkinTxt.Text.Trim();
            customer.ContactPhone      = this.skinTextBox_ContactPhone.SkinTxt.Text.Trim();
            customer.BankInfo          = this.skinTextBox_BankInfo.SkinTxt.Text.Trim();
            customer.Remarks           = this.skinTextBox_Remarks.SkinTxt.Text.Trim();
            customer.PfDiscount        = this.skinTextBox_Percent.Value;
            customer.BusinessAccountID = textBoxBusinessAccount.Text.Trim();
            customer.Password          = this.textBoxPwd.Text.Trim();
            customer.LastAccountTime   = DateTime.Now;
            customer.DefaultAddressID  = 0;
            customer.Balance           = 0;
            customer.PaymentBalance    = 0;
            if (node.Text != "所有分销客户")
            {
                customer.DistributorID = curItemID;
            }

            //  SupplyDiscount = Decimal.ToByte(this.numericUpDownSupplyDiscount.Value),
            customer.Enabled      = this.skinCheckBox_Enabled.Checked;
            customer.CreateTime   = DateTime.Now;
            customer.CustomerType = (byte)(skinRadioButtonSale.Checked ? 1 : 0);


            return(customer);
        }
        public SaveOffLineCustomerForm(String distributorID, PfCustomer item, TreeNode curNode = null)
        {
            InitializeComponent();
            // this.skinTextBoxID.KeyDown += SkinTxt_KeyDown;
            node      = curNode;
            curItemID = distributorID;
            if (item != null)
            {
                if (node != null)
                {
                    this.Text = "编辑";
                }
                else
                {
                    this.Text = "修改下线客户";
                }
                curPfCustomer = item;
            }
            else
            {
                this.skinTextBoxID.Text = GetNewId();
            }

            Display();
        }
 public WholesaleDeliveryPayForm(PfCustomer customer, decimal sumPfMoney)
 {
     InitializeComponent();
     this.customer   = customer;
     this.sumPfMoney = sumPfMoney;
     Initialize();
 }
        private bool ValidateItem(PfCustomer pfCustomer)
        {
            bool validate = true;

            if (String.IsNullOrEmpty(pfCustomer.ID))
            {
                GlobalMessageBox.Show("客户编号不能为空,请输入编号!");
                this.skinTextBoxID.Focus();
                validate = false;
            }
            else if (String.IsNullOrEmpty(pfCustomer.Name))
            {
                GlobalMessageBox.Show("客户名称不能为空,请输入名称!");
                this.skinTextBoxName.Focus();
                validate = false;
            }
            else if (String.IsNullOrEmpty(pfCustomer.Password))
            {
                GlobalMessageBox.Show("客户密码不能为空,请输入密码!");
                this.textBoxPwd.Focus();
                validate = false;
            }
            //BusinessAccountID 账套不能为当前账套
            string CurrbusinessAccountId = CommonGlobalCache.BusinessAccount.ID.ToUpper();

            if (pfCustomer.BusinessAccountID.ToUpper() == CurrbusinessAccountId)
            {
                GlobalMessageBox.Show("不能绑定当前账套!");
                this.textBoxBusinessAccount.Focus();
                validate = false;
            }
            return(validate);
        }
        private void Edit(PfCustomer item)
        {
            SaveOffLineCustomerForm form = new SaveOffLineCustomerForm(item.DistributorID, item);

            form.ConfirmClick += form_ConfirmClick_Edit;
            form.ShowDialog();
        }
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
     {
         return;
     }
     try
     {
         if (e.RowIndex > -1 && e.ColumnIndex > -1)
         {
             if (e.ColumnIndex == Column1.Index)
             {
                 PfCustomerRetailDetail detail = this.PfCustomerRetailDetailList[e.RowIndex];
                 this.PfCustomerRetailDetailList.RemoveAt(e.RowIndex);
                 if (PfCustomerRetailDetailList != null && PfCustomerRetailDetailList.Count == 0)
                 {
                     // 删除判断是否整个清空了,如果清空了,则清空客户信息
                     lastAddCustomer = null;
                 }
                 dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(this.PfCustomerRetailDetailList));
             }
         }
     }
     catch (Exception ee)
     {
         GlobalUtil.WriteLog(ee);
     }
 }
        private void form_ConfirmClick_Edit(PfCustomer item, SaveOffLineCustomerForm form)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                UpdateResult result = GlobalCache.ServerProxy.UpdateDistributor(item.ID, item.Name, item.Password);
                switch (result)
                {
                case UpdateResult.Success:
                    form.DialogResult = DialogResult.OK;
                    RefreshPage();
                    break;

                case UpdateResult.Error:
                    GlobalMessageBox.Show("内部错误!");
                    form.Cancel();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
Example #17
0
 private void skinComboBoxSupplier_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         supplier = skinComboBoxSupplier.SelectedItem as PfCustomer;
     }
     catch { }
 }
Example #18
0
 /// <summary>
 /// 新增供应商
 /// </summary>
 /// <param name="supplier"></param>
 public static void InsertPfCustomer(PfCustomer supplier)
 {
     if (supplier == null)
     {
         return;
     }
     pfCustomerList?.Add(supplier);
 }
Example #19
0
 //提交选择的会员
 private void ConfirmSelectCell(PfCustomer PfCustomer)
 {
     if (this.ItemSelected != null)
     {
         this.ItemSelected(PfCustomer, null);
     }
     this.DialogResult = DialogResult.OK;
 }
 private void skinComboBox_PfCustomer_ItemSelected(PfCustomer obj)
 {
     pfCustomer = obj;
     if (costumeItem != null)
     {
         this.textBoxAmount.Value = costumeItem.Price == 0 ? 0 : Math.Round(costumeItem.Price * pfCustomer.PfDiscount * (decimal)0.01, MidpointRounding.AwayFromZero);
     }
 }
Example #21
0
        private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode   node              = skinTreeViewClass.SelectedNode;
            TreeModel  CurClass          = node.Tag as TreeModel;
            PfCustomer pfCustomer        = PfCustomerCache.GetPfCustomer(CurClass.ID);
            SaveOffLineCustomerForm form = new SaveOffLineCustomerForm(CurClass.ID, pfCustomer, node);

            form.ShowDialog();
        }
Example #22
0
    {   /// <summary>
        /// 删除供应商
        /// </summary>
        /// <param name="supplierID"></param>
        public static void DeletePfCustomer(string supplierID)
        {
            PfCustomer oldSupplier = pfCustomerList.Find(s => s.ID == supplierID);

            if (oldSupplier == null)
            {
                return;
            }
            pfCustomerList.Remove(oldSupplier);
        }
Example #23
0
        private void skinTextBoxID_Leave(object sender, EventArgs e)
        {
            PfCustomer listItem = PfCustomerCache.PfCustomerList?.Find(t => t.ID == skinTextBoxID.Text);

            if (listItem != null)
            {
                GlobalMessageBox.Show("客户编号已存在");
                skinTextBoxID.Text = string.Empty;
                skinTextBoxID.Focus();
            }
        }
Example #24
0
        private void skinLabelAddSupplier_Click(object sender, EventArgs e)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <PfCustomer> list = (List <PfCustomer>) this.skinComboBox_PfCustomer.DataSource;
                NewWholesaleCustomerSimpleForm addForm = new NewWholesaleCustomerSimpleForm();
                if (addForm.ShowDialog(this) == DialogResult.OK)
                {
                    if (list == null)
                    {
                        list = new List <PfCustomer>();
                    }
                    PfCustomer item     = addForm.Result;
                    PfCustomer listItem = list.Find(t => t.Name == item.Name || t.ID == item.ID);
                    if (listItem == null)
                    {
                        item.Enabled    = true;
                        item.CreateTime = DateTime.Now;
                        InteractResult result = PfCustomerCache.PfCustomer_OnInsert(item);
                        switch (result.ExeResult)
                        {
                        case ExeResult.Success:
                            this.skinComboBox_PfCustomer.DataSource = null;
                            list.Add(item);
                            this.skinComboBox_PfCustomer.DisplayMember = "Name";
                            this.skinComboBox_PfCustomer.ValueMember   = "ID";
                            this.skinComboBox_PfCustomer.DataSource    = list;
                            // this.skinComboBox_SupplierID.SelectedIndex = list.IndexOf(item);
                            break;

                        case ExeResult.Error:
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        // this.skinComboBox_SupplierID.SelectedItem = listItem;
                    }
                }
            }
            catch (Exception ex) { GlobalUtil.ShowError(ex); }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
        private void skinTextBox_ID_Leave(object sender, EventArgs e)
        {
            //检查名称是否重复
            String     id         = skinTextBox_ID.Text;
            PfCustomer PfCustomer = PfCustomerCache.PfCustomerList.Find(t => t.ID.Equals(id));

            if (PfCustomer != null)
            {
                GlobalMessageBox.Show("客户编号已存在");
                //     skinTextBox_ID.Text = string.Empty;
                skinTextBox_ID.Focus();
            }
        }
Example #26
0
        /// <summary>
        /// 更新供应商
        /// </summary>
        /// <param name="supplier"></param>
        public static void UpdatePfCustomer(PfCustomer supplier)
        {
            if (supplier == null)
            {
                return;
            }
            PfCustomer oldSupplier = pfCustomerList?.Find(s => s.ID == supplier.ID);

            if (oldSupplier != null)
            {
                pfCustomerList?.Remove(oldSupplier);
            }
            pfCustomerList?.Add(supplier);
        }
Example #27
0
        private void BaseButton1_Click(object sender, EventArgs e)
        {
            String id   = this.skinTextBoxID.SkinTxt.Text.Trim();
            String name = this.skinTextBoxName.SkinTxt.Text.Trim();
            String pwd  = this.textBoxPwd.SkinTxt.Text.Trim();

            if (String.IsNullOrEmpty(id))
            {
                this.skinTextBoxID.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(name))
            {
                this.skinTextBoxName.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(pwd))
            {
                this.textBoxPwd.Focus();
                return;
            }
            byte customerType = 0;

            if (skinRadioButtonSale.Checked)
            {
                customerType = 1;
            }
            else if (skinRadioButtonBuyout.Checked)
            {
                customerType = 0;
            }
            //skinRadioButtonBuyout.Checked = this.curPfCustomer.CustomerType == 0;
            decimal pfDiscount = this.textBoxDicount.Value;

            this.result = new PfCustomer()
            {
                ID             = id,
                Name           = name,
                Password       = pwd,
                FirstCharSpell = DisplayUtil.GetPYString(name),
                CustomerType   = customerType,
                PfDiscount     = pfDiscount,
                // SupplyDiscount = Decimal.ToByte(numericUpDownSupplyDiscount.Value)
            };



            this.DialogResult = DialogResult.OK;
        }
Example #28
0
 private void dataGridView3_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && !dataGridView3.Rows[e.RowIndex].IsNewRow)
     {
         DataGridView      view = (DataGridView)sender;
         List <PfCustomer> list = DataGridViewUtil.BindingListToList <PfCustomer>(view.DataSource);
         //  List<PfCustomer> list = (List<PfCustomer>)view.DataSource;
         PfCustomer Mitem = (PfCustomer)list[e.RowIndex];
         if (e.ColumnIndex == seeCommissionDataGridViewCheckBoxColumn1.Index)
         {
             Mitem.SeeCommission = (bool)this.dataGridView3[e.ColumnIndex, e.RowIndex].Value;
             UpIsCheck(Mitem.ID, Mitem.SeeCommission);
         }
     }
 }
Example #29
0
        private List <CostumeStoreExcel> GetCostumeStoreExcels()
        {
            PfCustomer pfCustomer           = PfCustomerCache.GetPfCustomer(pfCustomeId);
            List <CostumeStoreExcel> excels = new List <CostumeStoreExcel>();

            foreach (var item in this.curInboundDetailList)
            {
                CostumeStoreExcel curStoreExcel = GetCostumeStoreExcel(item);
                curStoreExcel.CostumeColorName = item.ColorName;
                //   curStoreExcel.PfPrice = item.Price * pfCustomer.PfDiscount/100;
                excels.Add(curStoreExcel);
            }

            return(excels);
        }
        private void skinTextBox_Name_Leave(object sender, EventArgs e)
        {
            //检查名称是否重复
            String     PfCustomerName = skinTextBox_Name.Text;
            PfCustomer PfCustomer     = PfCustomerCache.PfCustomerList.Find(t => t.Name.Equals(PfCustomerName));

            if (PfCustomer != null)
            {
                if (curPfCustomer != null && curPfCustomer.ID != PfCustomer.ID)
                {
                    GlobalMessageBox.Show("客户名称已存在!");
                    skinTextBox_Name.Focus();
                }
            }
        }