예제 #1
0
 public AddLevelModelForm(int level, OperationEnum action = OperationEnum.Add, int listcount = 0, CommissionTemplate commtemp = null)
 {
     InitializeComponent();
     this.item   = commtemp;
     this.action = action;
     CurLevel    = level;
     lCount      = listcount;
     Initialize();
 }
예제 #2
0
        private void Delete(List <CommissionTemplate> list, CommissionTemplate item)
        {
            InteractResult result = CommonGlobalCache.ServerProxy.DeleteCommissionTemplate(item.AutoID);

            switch (result.ExeResult)
            {
            case ExeResult.Success:
                GlobalMessageBox.Show("删除成功!");
                this.dataGridView1.DataSource = null;
                list.Remove(item);
                RefreshPageGetData();
                //  this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list);
                break;

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

            default:
                break;
            }
        }
예제 #3
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
     {
         return;
     }
     try
     {
         if (e.RowIndex > -1 && e.ColumnIndex > -1)
         {
             if (GlobalUtil.EngineUnconnectioned(this))
             {
                 return;
             }
             List <CommissionTemplate> list = (List <CommissionTemplate>)(dataGridView1.DataSource);
             CommissionTemplate        item = (CommissionTemplate)list[e.RowIndex];
             if (e.ColumnIndex == Column1.Index)
             {
                 AddLevelModelForm AddCommissionTemplate = new AddLevelModelForm(0, OperationEnum.Edit, ListCount, item);
                 if (AddCommissionTemplate.ShowDialog(this) == DialogResult.OK)
                 {
                     RefreshPageGetData();
                 }
             }
             else
             if (e.ColumnIndex == ColumnDelete.Index)
             {
                 InteractResult <bool> IsUseresult = CommonGlobalCache.ServerProxy.IsCommissionTemplateUse(item.AutoID);
                 if (IsUseresult.Data)
                 {
                     GlobalMessageBox.Show("有商品在使用该模板,不能删除!");
                     return;
                 }
                 else
                 {
                     if (item.IsDefault)
                     {
                         if (GlobalMessageBox.Show("删除默认模板会导致后续的批发分销佣金为0,若删除请重新设置默认模板,是否确认删除?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes)
                         {
                             return;
                         }
                         else
                         {
                             Delete(list, item);
                         }
                     }
                     else
                     {
                         if (GlobalMessageBox.Show("确定删除该模板吗?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes)
                         {
                             return;
                         }
                         else
                         {
                             Delete(list, item);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         GlobalUtil.ShowError(ex);
     }
     finally
     {
         GlobalUtil.UnLockPage(this);
     }
 }
예제 #4
0
        private void baseButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                string tempName = skinTextBoxID.SkinTxt.Text;

                if (string.IsNullOrEmpty(tempName))
                {
                    ShowMessage("模板名称不能为空!");
                    this.skinTextBoxID.Focus();
                    return;
                }
                if (!CheckValidate())
                {
                    return;
                }
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                CommissionTemplate comTemp = new CommissionTemplate();
                comTemp.Name      = this.skinTextBoxID.SkinTxt.Text;
                comTemp.FirstRate = this.numericTxtFirstScale.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtFirstScale.SkinTxt.Text.Trim());
                comTemp.Rate1     = this.numericTxtBoxOne.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxOne.SkinTxt.Text.Trim());
                comTemp.Rate2     = this.numericTxtBoxTwo.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTwo.SkinTxt.Text.Trim());
                comTemp.Rate3     = this.numericTxtBoxThree.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxThree.SkinTxt.Text.Trim());
                comTemp.Rate4     = this.numericTxtBoxFour.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFour.SkinTxt.Text.Trim());
                comTemp.Rate5     = this.numericTxtBoxFive.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFive.SkinTxt.Text.Trim());
                comTemp.Rate6     = this.numericTxtBoxSix.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSix.SkinTxt.Text.Trim());
                comTemp.Rate7     = this.numericTxtBoxSeven.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSeven.SkinTxt.Text.Trim());
                comTemp.Rate8     = this.numericTxtBoxEight.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxEight.SkinTxt.Text.Trim());
                comTemp.Rate9     = this.numericTxtBoxNine.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxNine.SkinTxt.Text.Trim());
                comTemp.Rate10    = this.numericTxtBoxTen.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTen.SkinTxt.Text.Trim());
                comTemp.IsDefault = skinIsDefault.Checked;

                /*  DistributionInfo distributionInfo = new DistributionInfo();
                 * distributionInfo.CommissionRate1 = this.numericTxtBoxOne.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxOne.SkinTxt.Text.Trim());
                 * distributionInfo.CommissionRate2 = this.numericTxtBoxTwo.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTwo.SkinTxt.Text.Trim());
                 * distributionInfo.CommissionRate3 = this.numericTxtBoxThree.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxThree.SkinTxt.Text.Trim());
                 * distributionInfo.CommissionRate4 = this.numericTxtBoxFour.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFour.SkinTxt.Text.Trim());
                 *
                 * distributionInfo.CommissionRate5 = this.numericTxtBoxFive.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFive.SkinTxt.Text.Trim());
                 *
                 *
                 * distributionInfo.CommissionRate6 = this.numericTxtBoxSix.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSix.SkinTxt.Text.Trim());
                 *
                 * distributionInfo.CommissionRate7 = this.numericTxtBoxSeven.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSeven.SkinTxt.Text.Trim());
                 *
                 * distributionInfo.CommissionRate8 = this.numericTxtBoxEight.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxEight.SkinTxt.Text.Trim());
                 * distributionInfo.CommissionRate9 = this.numericTxtBoxNine.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxNine.SkinTxt.Text.Trim());
                 * distributionInfo.CommissionRate10 = this.numericTxtBoxTen.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTen.SkinTxt.Text.Trim());
                 * distributionInfo.CommissionFirstRate = this.numericTxtFirstScale.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtFirstScale.SkinTxt.Text.Trim());
                 *
                 * InteractResult interactR = CommonGlobalCache.ServerProxy.UpdateDistributionInfo(new DistributionInfo()
                 * {
                 * //   Level = (int)this.skinComboBox_Level.SelectedValue,
                 *    CommissionRate1 = distributionInfo.CommissionRate1,
                 *    CommissionRate2 = distributionInfo.CommissionRate2,
                 *    CommissionRate3 = distributionInfo.CommissionRate3,
                 *    CommissionRate4 = distributionInfo.CommissionRate4,
                 *    CommissionRate5 = distributionInfo.CommissionRate5,
                 *    CommissionRate6 = distributionInfo.CommissionRate6,
                 *    CommissionRate7 = distributionInfo.CommissionRate7,
                 *    CommissionRate8 = distributionInfo.CommissionRate8,
                 *    CommissionRate9 = distributionInfo.CommissionRate9,
                 *    CommissionRate10 = distributionInfo.CommissionRate10,
                 *    CommissionFirstRate = distributionInfo.CommissionFirstRate
                 *
                 * });*/



                if (action == OperationEnum.Add)
                {
                    if (skinIsDefault.Checked)
                    {
                        InteractResult <bool> result = CommonGlobalCache.ServerProxy.IsCommissionTemplateHaveDefault();

                        if (result.Data)
                        {
                            if (GlobalMessageBox.Show("默认模板已存在,是否覆盖?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                comTemp.IsDefault = true;
                            }
                            else
                            {
                                comTemp.IsDefault          = false;
                                this.skinIsDefault.Checked = false;
                            }
                            //ShowMessage("分销佣金模板已被设置");
                        }
                    }
                    else
                    {
                        comTemp.IsDefault = false;
                    }
                    InteractResult interactR = CommonGlobalCache.ServerProxy.InsertCommissionTemplate(comTemp);
                    switch (interactR.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("新增成功!");
                        this.DialogResult = DialogResult.OK;
                        break;

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

                    default:
                        break;
                    }
                }
                else if (action == OperationEnum.Edit)
                {
                    comTemp.AutoID = item.AutoID;
                    if (skinIsDefault.Checked)
                    {
                        InteractResult <bool> result = CommonGlobalCache.ServerProxy.IsCommissionTemplateHaveDefault();

                        if (result.Data && isDefaultRecord == false)
                        {
                            if (GlobalMessageBox.Show("默认模板已存在,是否覆盖?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                comTemp.IsDefault = true;
                            }
                            else
                            {
                                comTemp.IsDefault          = false;
                                this.skinIsDefault.Checked = false;
                            }
                            //ShowMessage("分销佣金模板已被设置");
                        }
                    }
                    else
                    {
                        comTemp.IsDefault = false;
                    }

                    InteractResult interactR = CommonGlobalCache.ServerProxy.UpdateCommissionTemplate(comTemp);
                    switch (interactR.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("保存成功!");
                        this.DialogResult = DialogResult.OK;
                        break;

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

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }