コード例 #1
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
     {
         return;
     }
     try
     {
         if (e.RowIndex > -1 && e.ColumnIndex > -1)
         {
             List <GiftTicketTemplate> list = DataGridViewUtil.BindingListToList <GiftTicketTemplate>(this.dataGridView1.DataSource);
             GiftTicketTemplate        item = (GiftTicketTemplate)list[e.RowIndex];
             if (ColumnEdit.Index == e.ColumnIndex)
             {
                 Edit(item);
             }
             else if (ColumnDelete.Index == e.ColumnIndex)
             {
                 Delete(list, item);
             }
         }
     }
     catch (Exception ex)
     {
         GlobalUtil.ShowError(ex);
     }
 }
コード例 #2
0
 private void Edit(GiftTicketTemplate item)
 {
     if (HasPermission(RolePermissionEnum.编辑))
     {
         this.SaveClick(item, this);
     }
 }
コード例 #3
0
 private void SetItem(GiftTicketTemplate item)
 {
     item.Denomination      = Decimal.ToInt32(numericTextBox_denomination.Value);
     item.MinMoney          = String.IsNullOrEmpty(skinTextBox_minMoney.Text) ? 0 : Convert.ToInt32(skinTextBox_minMoney.Text);
     item.MinDiscount       = String.IsNullOrEmpty(skinTextBox_minDiscount.Text) ? 0 : Convert.ToDecimal(skinTextBox_minDiscount.Text);
     item.TicketDescription = skinLabelTicketDesc.Text;
     item.OperatorUserID    = GlobalCache.CurrentUserID;
     item.IsAnd             = skinRadioButton2.Checked;
 }
コード例 #4
0
        private bool Validate(GiftTicketTemplate item)
        {
            bool success = true;

            if (item.Denomination <= 0)
            {
                GlobalMessageBox.Show("面额必须大于0");
                this.numericTextBox_denomination.Focus();
                success = false;
            }
            else
            if (skinRadioButton1.Checked)
            {
                //单选项
                if (item.MinMoney <= 0)
                {
                    if (item.MinDiscount <= 0)
                    {
                        GlobalMessageBox.Show("最低折扣必须大于0");
                        this.skinTextBox_minDiscount.Focus();
                        success = false;
                    }
                }
                else
                if (item.MinDiscount <= 0)
                {
                    if (item.MinMoney <= 0)
                    {
                        GlobalMessageBox.Show("最低金额必须大于0");
                        this.skinTextBox_minMoney.Focus();
                        success = false;
                    }
                }
            }
            else if (skinRadioButton2.Checked)
            { //并且
                if (item.MinMoney <= 0)
                {
                    GlobalMessageBox.Show("最低金额必须大于0");
                    this.skinTextBox_minMoney.Focus();
                    success = false;
                }
                else
                if (item.MinDiscount <= 0)
                {
                    GlobalMessageBox.Show("最低折扣必须大于0");
                    this.skinTextBox_minDiscount.Focus();
                    success = false;
                }
            }
            return(success);
        }
コード例 #5
0
 public SaveGiftTicketTemplateCtrl(GiftTicketTemplate item)
 {
     InitializeComponent();
     try
     {
         skinTextBox_minMoney.SkinTxt.Validated    += SkinTxt_Validated;;
         skinTextBox_minDiscount.SkinTxt.Validated += SkinTxt_Validated;
         this.curItem = item;
         Display();
     }
     catch (Exception ex)
     {
         GlobalUtil.ShowError(ex);
     }
 }
コード例 #6
0
 private void Delete(List <GiftTicketTemplate> list, GiftTicketTemplate item)
 {
     if (!HasPermission(RolePermissionEnum.除))
     {
         return;
     }
     if (GlobalMessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         DeleteResult result = GlobalCache.ServerProxy.DeleteGiftTicketTemplate(item.AutoID);
         if (result == DeleteResult.Error)
         {
             GlobalMessageBox.Show("内部错误!");
             return;
         }
         else
         {
             GlobalMessageBox.Show("删除成功!");
             this.dataGridView1.DataSource = null;
             list.Remove(item);
             this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list);
         }
     }
 }
コード例 #7
0
 public void Refresh(GiftTicketTemplate e)
 {
     curItem = e;
     Display();
 }
コード例 #8
0
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (curItem == null)
                {
                    GiftTicketTemplate item = new GiftTicketTemplate()
                    {
                    };

                    SetItem(item);
                    if (!Validate(item))
                    {
                        return;
                    }
                    item.CreateTime = DateTime.Now;
                    if (GlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }
                    InsertResult result = GlobalCache.ServerProxy.InsertGiftTicketTemplate(item);
                    switch (result)
                    {
                    case InsertResult.Error:
                        GlobalMessageBox.Show("内部错误!");
                        break;

                    default:
                        GlobalMessageBox.Show("添加成功!");

                        TabPage_Close(this.CurrentTabPage, this.SourceCtrlType);
                        break;
                    }
                }
                else
                {
                    SetItem(curItem);
                    if (!Validate(curItem))
                    {
                        return;
                    }
                    if (GlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }
                    UpdateResult result = GlobalCache.ServerProxy.UpdateGiftTicketTemplate(curItem);
                    switch (result)
                    {
                    case UpdateResult.Error:
                        GlobalMessageBox.Show("内部错误!");
                        break;

                    default:
                        GlobalMessageBox.Show("保存成功!");
                        TabPage_Close(this.CurrentTabPage, this.SourceCtrlType);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
コード例 #9
0
ファイル: SendGiftTicketCtrl.cs プロジェクト: jollitycn/JGNet
        private void skinComboBox_giftTicket_SelectedIndexChanged(object sender, EventArgs e)
        {
            GiftTicketTemplate template = skinComboBox_giftTicket.SelectedItem as GiftTicketTemplate;

            skinTextBoxMoney.Text = template.Denomination.ToString();
        }