Ejemplo n.º 1
0
        private void bt_add_Click(object sender, EventArgs e)
        {
            MemberTypeInfo mti = new MemberTypeInfo();

            if (tb_level.Text != "")
            {
                if (tb_type.Text != "")
                {
                    if (tb_discount.Text != "")
                    {
                        mti.Mid = Convert.ToInt32(tb_level.Text);

                        mti.Mtitle = tb_type.Text;

                        mti.Mdiscount = Convert.ToDecimal(tb_discount.Text);

                        if (mbtbll.Add(mti))
                        {
                            this.GetDataList();
                        }
                        else
                        {
                            MessageBox.Show("添加错误,级别已存在不能重复");
                        }
                    }
                    else
                    {
                        MessageBox.Show("折扣不能为空且不能是文字");
                    }
                }
                else
                {
                    MessageBox.Show("类型不能为空");
                }
            }
            else
            {
                MessageBox.Show("级别不能为空");
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                MemberType mebtype = new MemberType();

                if (currentId != String.Empty)
                {
                    mebtype.MemberTypeId = int.Parse(currentId);
                }

                if (!string.IsNullOrEmpty(txtMemberTypeName.Text.Trim()) || !string.IsNullOrEmpty(txtMemberTypeName2.Text.Trim()) || !string.IsNullOrEmpty(txtMemberTypeName3.Text.Trim()))
                {
                    mebtype.MemberTypeName  = txtMemberTypeName.Text;
                    mebtype.MemberTypeName2 = txtMemberTypeName2.Text;
                    mebtype.MemberTypeName3 = txtMemberTypeName3.Text;
                    DialogResult r = CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM227"), Common.clsLanguages.GetResource("CRM11"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO);
                    if (r == DialogResult.Yes)
                    {
                        if (!string.IsNullOrEmpty(currentId))
                        {    // update
                            memBLL.Edit(mebtype);
                        }
                        else
                        {    //add
                            memBLL.Add(mebtype);
                        }
                        GetLists_InGridCustommerType();

                        if (!string.IsNullOrEmpty(memBLL.ErrorString))
                        {
                            CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM219"),
                                                                             Common.clsLanguages.GetResource("CRM11"),
                                                                             Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                             Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                            return;
                        }
                    }
                }
                else
                {
                    CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRMErrEmpCusType"),
                                                                     Common.clsLanguages.GetResource("CRM11"),
                                                                     Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                     Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                    return;
                }
            }
            catch (Exception)
            {
                string code = System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString();
                if (code == "-532462766")
                {
                    CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM292"),
                                                                     Common.clsLanguages.GetResource("CRM11"),
                                                                     Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                     Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                }
                return;
            }
        }