예제 #1
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            cmdDelete.Enabled = false;

            try
            {
                int tempID = int.Parse(lsvPhones.SelectedItems[0].Text);
                if (tempID.ToString() != "")
                {
                    isBusy.Visible = true;
                    DelegateDeletePhoneSell dn = MysqlControl.DeletePhoneSell;

                    IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                    while (iar.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                    if (iResult.isSuccess)
                    {
                        var iDResult = new MysqlController.ReturnResult {
                            isSuccess = false
                        };
                        while (!iDResult.isSuccess)
                        {
                            DelegateDeleteCustomDebtByPhoneID dn1 = MysqlControl.DeleteCustomDebtByPhoneID;

                            IAsyncResult iar1 = dn1.BeginInvoke(tempID, null, null);

                            while (iar1.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            iDResult = dn1.EndInvoke(iar1);
                        }

                        MessageBox.Show("删除销售记录成功!", Application.ProductName, MessageBoxButtons.OK);
                        RefreshCustom(dtpDaily.Value.Year + dtpDaily.Value.Month.ToString().PadLeft(2, '0') +
                                      dtpDaily.Value.Day.ToString().PadLeft(2, '0'));
                    }
                    else
                    {
                        MessageBox.Show("删除销售记录失败!错误原因" + iResult.ErrDesc, Application.ProductName,
                                        MessageBoxButtons.OK);
                    }
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdDelete.Enabled = true;
                return;
            }
            isBusy.Visible    = false;
            cmdDelete.Enabled = true;
        }
예제 #2
0
        private void cmdDeltePhone_Click(object sender, EventArgs e)
        {
            DelegateDeletePhoneSell dn = MysqlControl.DeletePhoneSell;

            IAsyncResult iar = dn.BeginInvoke(int.Parse(lblID.Text), null, null);

            while (iar.IsCompleted == false)
            {
                Application.DoEvents();
            }

            MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

            if (iResult.isSuccess)
            {
                MessageBox.Show(Resources.frmEditPhone_cmdDeltePhone_Click_删除该部手机成功_, Application.ProductName,
                                MessageBoxButtons.OK);
                var iCustem = new frmEditPhone(isBusy, iLoginUser)
                {
                    TopLevel = false, Dock = DockStyle.Fill, Parent = Parent
                };
                iCustem.Show();
                iCustem.BringToFront();
                Parent.BringToFront();
            }
            else
            {
                MessageBox.Show(Resources.frmEditPhone_cmdDeltePhone_Click_删除该部手机失败__错误原因_ + iResult.ErrDesc,
                                Application.ProductName, MessageBoxButtons.OK);
            }
        }
예제 #3
0
 private void cmdDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (lsvTutorial.SelectedItems[0].Text != null)
         {
             if (lsvTutorial.SelectedItems[0].Text != "")
             {
                 MysqlController.ReturnResult iResult =
                     MysqlControl.DelLXTutorial(int.Parse(lsvTutorial.SelectedItems[0].Text));
                 if (iResult.isSuccess)
                 {
                     MessageBox.Show(Resources.frmTutorial_cmdDel_Click_删除该教程成功_, Application.ProductName, MessageBoxButtons.OK);
                     lsvTutorial.SelectedItems[0].Remove();
                 }
                 else
                 {
                     MessageBox.Show(Resources.frmTutorial_cmdDel_Click_ + iResult.ErrDesc, Application.ProductName,
                                     MessageBoxButtons.OK);
                 }
             }
         }
     }
     catch (Exception)
     {
         return;
     }
 }
예제 #4
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            cmdAdd.Enabled = false;

            if (txtSplitPrice.Text == "" || !Regex.IsMatch(txtSplitPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmCustomDebt_cmdAdd_Click_请填写正确的客户欠款金额_, Application.ProductName,
                                MessageBoxButtons.OK);
                cmdAdd.Enabled = true;
                return;
            }

            if (MessageBox.Show(
                    Resources.frmSplitDebt_cmdAdd_Click_ + Resources.frmSplitDebt_cmdAdd_Click_还款日期_ +
                    dtpSplitDate.Value.Year +
                    dtpSplitDate.Value.Month.ToString().PadLeft(2, '0') +
                    dtpSplitDate.Value.Day.ToString().PadLeft(2, '0') + Resources.frmSplitDebt_cmdAdd_Click_ +
                    txtSplitPrice.Text + Resources.frmSplitDebt_cmdAdd_Click_ +
                    txtBackup.Text, Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                var iSplitDebt = new MysqlController.LXSplitDebt();
                iSplitDebt.SplitDebtID     = int.Parse(lblID.Text);
                iSplitDebt.SplitDebtType   = cmbSplitType.SelectedIndex;
                iSplitDebt.SplitDebtPrice  = double.Parse(txtSplitPrice.Text);
                iSplitDebt.SplitDebtBackup = txtBackup.Text;
                iSplitDebt.SplitDebtDate   = dtpSplitDate.Value.Year + dtpSplitDate.Value.Month.ToString().PadLeft(2, '0') +
                                             dtpSplitDate.Value.Day.ToString().PadLeft(2, '0');
                isBusy.Visible = true;
                DelegateAddSplitDebt dn = MysqlControl.AddSplitDebt;

                IAsyncResult iar = dn.BeginInvoke(iSplitDebt, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                isBusy.Visible = false;
                if (iResult.isSuccess)
                {
                    MessageBox.Show(Resources.frmSplitDebt_cmdAdd_Click_增加用户分期付款成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show(Resources.frmSplitDebt_cmdAdd_Click_增加用户分期付款失败__错误原因_ + iResult.ErrDesc,
                                    Application.ProductName, MessageBoxButtons.OK);
                }
                RefreshSplitDebt();
            }
            cmdAdd.Enabled = true;
            isHaveChange   = true;
        }
예제 #5
0
        private void cmdEditData_Click(object sender, EventArgs e)
        {
            try
            {
                isBusy.Visible      = true;
                cmdEditData.Enabled = false;
                int tempID = int.Parse(lsvResult.SelectedItems[0].Text);
                if (tempID.ToString() != "")
                {
                    var iAdd = new frmAskforLeaveEditor {
                        Location = lsvResult.Location
                    };

                    Point p = PointToScreen(lsvResult.Location);
                    iAdd.tempSeller = cmbSellers.Text;
                    iAdd.iAsk       = MysqlControl.ReadAskByID(tempID.ToString());
                    iAdd.SetDesktopBounds(p.X + groupBox2.Location.X + groupBox3.Location.X,
                                          p.Y + groupBox2.Location.Y + groupBox3.Location.Y, iAdd.Width,
                                          iAdd.Height);
                    if (iAdd.ShowDialog() == DialogResult.OK)
                    {
                        DelegateEditAsk dn = MysqlControl.EditAsk;

                        IAsyncResult iar = dn.BeginInvoke(iAdd.iAsk, null, null);

                        while (iar.IsCompleted == false)
                        {
                            Application.DoEvents();
                        }

                        MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                        if (iResult.isSuccess)
                        {
                            MessageBox.Show("修改请假记录成功!", Application.ProductName, MessageBoxButtons.OK);
                            cmdSearch_Click(sender, e);
                        }
                        else
                        {
                            MessageBox.Show("修改请假记录失败!错误原因" + iResult.ErrDesc, Application.ProductName,
                                            MessageBoxButtons.OK);
                        }
                    }
                }
            }
            catch (Exception)
            {
                isBusy.Visible      = false;
                cmdEditData.Enabled = true;
                return;
            }
            isBusy.Visible      = false;
            cmdEditData.Enabled = true;
        }
예제 #6
0
        private void S_Click(object sender, EventArgs e)
        {
            S.Enabled       = false;
            picWait.Visible = true;
            DelegateChangeSecondHands dn = MysqlControl.ChangeSecondHands;

            bool   tempResult = true;
            string tempReason = "";
            var    iResult    = new MysqlController.ReturnResult[lsvSecondHands.Items.Count];

            for (int i = 0; i < lsvSecondHands.Items.Count; i++)
            {
                IAsyncResult iar = dn.BeginInvoke(lsvSecondHands.Items[i].Text,
                                                  lsvSecondHands.Items[i].SubItems[9].Text, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                iResult[i] = dn.EndInvoke(iar);
            }

            for (int i = 0; i < iResult.Length; i++)
            {
                if (!iResult[i].isSuccess)
                {
                    tempResult = false;
                    tempReason = iResult[i].ErrDesc;
                }
                else
                {
                    tempResult = true;
                }
            }
            if (tempResult)
            {
                MessageBox.Show(Resources.frmSecondHands_S_Click_修改价格成功_, Application.ProductName, MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show(Resources.frmSecondHands_S_Click_ + tempReason, Application.ProductName,
                                MessageBoxButtons.OK);
            }

            picWait.Visible = false;
            S.Enabled       = true;
        }
예제 #7
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                isBusy.Visible    = true;
                cmdDelete.Enabled = false;
                int tempID = int.Parse(lsvResult.SelectedItems[0].Text);
                if (tempID.ToString() != "")
                {
                    DelegateDeleteAsk dn = MysqlControl.DeleteAsk;

                    IAsyncResult iar = dn.BeginInvoke(tempID.ToString(), null, null);

                    while (iar.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                    if (iResult.isSuccess)
                    {
                        MessageBox.Show(Resources.frmAskforLeave_cmdDelete_Click_删除记录成功_, Application.ProductName,
                                        MessageBoxButtons.OK);
                        lsvResult.SelectedItems[0].Remove();
                    }
                    else
                    {
                        MessageBox.Show(Resources.frmAskforLeave_cmdDelete_Click_ + iResult.ErrDesc,
                                        Application.ProductName,
                                        MessageBoxButtons.OK);
                    }
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdDelete.Enabled = true;
                return;
            }
            isBusy.Visible    = false;
            cmdDelete.Enabled = true;
        }
예제 #8
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            isBusy.Visible    = true;
            cmdDelete.Enabled = false;
            try
            {
                int tempID = int.Parse(lsvPayout.SelectedItems[0].SubItems[5].Text);

                DelegateDeletePayout dn = MysqlControl.DeletePayout;

                IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    MessageBox.Show(Resources.frmViewProfit_cmdDelete_Click_删除支出记录成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    RefreshPayout(dtpFromTime.Value.Year + dtpFromTime.Value.Month.ToString().PadLeft(2, '0') +
                                  dtpFromTime.Value.Day.ToString().PadLeft(2, '0'));
                }
                else
                {
                    MessageBox.Show(Resources.frmViewProfit_cmdDelete_Click_ + iResult.ErrDesc, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdDelete.Enabled = true;

                return;
            }
            isBusy.Visible    = false;
            cmdDelete.Enabled = true;
        }
예제 #9
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            cmdDelete.Enabled = false;

            try
            {
                isBusy.Visible = true;
                int tempID = int.Parse(lsvSplit.SelectedItems[0].Text);
                DelegateDeleteSplitDebt dn = MysqlControl.DeleteSplitDebt;

                IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);
                isBusy.Visible = false;
                if (iResult.isSuccess)
                {
                    MessageBox.Show(Resources.frmSplitDebt_cmdDelete_Click_删除用户分期付款成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show(Resources.frmSplitDebt_cmdDelete_Click_删除用户分期付款失败__错误原因_ + iResult.ErrDesc,
                                    Application.ProductName, MessageBoxButtons.OK);
                }
                RefreshSplitDebt();
            }
            catch (Exception)
            {
                cmdDelete.Enabled = true;
                return;
            }
            isHaveChange      = true;
            cmdDelete.Enabled = true;
        }
예제 #10
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            try
            {
                cmdEdit.Enabled = false;
                int tempID = int.Parse(lsvDebt.SelectedItems[0].Text);
                if (tempID.ToString() != "")
                {
                    var iAdd = new frmCustomDebtEditor {
                        Location = lsvDebt.Location
                    };

                    Point p = PointToScreen(lsvDebt.Location);

                    iAdd.SetDesktopBounds(p.X + groupBox2.Location.X + groupBox4.Location.X,
                                          p.Y + groupBox2.Location.Y + groupBox4.Location.Y, iAdd.Width,
                                          iAdd.Height);

                    isBusy.Visible = true;

                    DelegateReadCustomDebtByID dn = MysqlControl.ReadCustomDebt;

                    IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                    while (iar.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    MysqlController.LXCustomDebt[] tempDebt = dn.EndInvoke(iar);
                    iAdd.iDebt = tempDebt[0];

                    isBusy.Visible = false;

                    if (iAdd.ShowDialog() == DialogResult.OK)
                    {
                        MysqlController.ReturnResult iResult = MysqlControl.EditCustomDebt(iAdd.iDebt);
                        if (iResult.isSuccess)
                        {
                            var iLog = new clsLog.LogPart();

                            iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                           DateTime.Now.Day.ToString().PadLeft(2, '0');
                            iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                            iLog.LogUser   = iLoginUser;
                            iLog.LogDetail = @"修改客户欠款记录 编号为:" + tempID;

                            DelegateAddLog dnlog = LogControl.AddLog;

                            IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                            while (iarlog.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            dnlog.EndInvoke(iarlog);

                            MessageBox.Show("修改客户欠款成功!", Application.ProductName, MessageBoxButtons.OK);
                            RefreshCustom(iSavestrDate, false);
                        }
                        else
                        {
                            MessageBox.Show("修改客户欠款失败!错误原因" + iResult.ErrDesc, Application.ProductName,
                                            MessageBoxButtons.OK);
                        }
                    }
                }
            }
            catch (Exception)
            {
                cmdEdit.Enabled = true;
                return;
            }
            cmdEdit.Enabled = true;
        }
예제 #11
0
        private void cmdConvert2Payout_Click(object sender, EventArgs e)
        {
            int tempID = int.Parse(lsvDebt.SelectedItems[0].Text);

            var iPayout = new MysqlController.Payout
            {
                PayoutBackup =
                    lsvDebt.SelectedItems[0].SubItems[1].Text + " " +
                    lsvDebt.SelectedItems[0].SubItems[2].Text + ",欠款原因:" +
                    lsvDebt.SelectedItems[0].SubItems[3].Text,
                PayoutName  = "客户欠款",
                PayoutPrice = lsvDebt.SelectedItems[0].SubItems[4].Text,
                PayoutType  = Resources.frmCustomDebt_CleanUI__0,
                PayoutDate  = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                              DateTime.Now.Day.ToString().PadLeft(2, '0')
            };

            isBusy.Visible = true;
            DelegateAddPayout dn = MysqlControl.AddPayout;

            IAsyncResult iar = dn.BeginInvoke(iPayout, null, null);

            while (iar.IsCompleted == false)
            {
                Application.DoEvents();
            }

            MysqlController.ReturnResult iResult = dn.EndInvoke(iar);
            isBusy.Visible = false;
            if (iResult.isSuccess)
            {
                var iLog = new clsLog.LogPart();

                iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                               DateTime.Now.Day.ToString().PadLeft(2, '0');
                iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                iLog.LogUser   = iLoginUser;
                iLog.LogDetail = @"转换客户欠款到固定支出 编号为:" + tempID;

                DelegateAddLog dnlog = LogControl.AddLog;

                IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                while (iarlog.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                dnlog.EndInvoke(iarlog);

                MessageBox.Show(Resources.frmPayout_cmdAdd_Click_添加支出记录成功, Application.ProductName, MessageBoxButtons.OK);

                MysqlController.ReturnResult iDResult;
                iDResult.isSuccess = false;
                isBusy.Visible     = true;
                while (iDResult.isSuccess != true)
                {
                    DelegateDeleteCustomDebt dnd = MysqlControl.DeleteCustomDebt;

                    IAsyncResult iard = dnd.BeginInvoke(tempID, null, null);

                    while (iard.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    iDResult = dnd.EndInvoke(iard);
                }
                isBusy.Visible = false;
                RefreshCustom(iSavestrDate, false);
            }
            else
            {
                MessageBox.Show(Resources.frmPayout_cmdAdd_Click_ + iResult.ErrDesc, Application.ProductName,
                                MessageBoxButtons.OK);
            }
            isBusy.Visible = false;
        }
예제 #12
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            if (txtCash.Text == "" || !Regex.IsMatch(txtCash.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmCustomDebt_cmdAdd_Click_请填写正确的客户欠款金额_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            if (txtMaster.Text == "")
            {
                MessageBox.Show(Resources.frmCustomDebt_cmdAdd_Click_请填写正确的客户欠款人名称_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtName.Text == "")
            {
                MessageBox.Show(Resources.frmCustomDebt_cmdAdd_Click_请填写正确的客户欠款事项_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            cmdAdd.Enabled = false;

            if (MessageBox.Show(
                    "是否确认如下递交内容?\r\n欠款人:" + txtMaster.Text + "\r\n欠款时间:" + dtpTime.Value.Year +
                    dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                    dtpTime.Value.Day.ToString().PadLeft(2, '0') + "\r\n欠款金额:" + txtCash.Text + "元\r\n欠款事项:" + txtName.Text +
                    "\r\n到帐方式:" + cmbPayment.Text, Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                var iCustemDebt = new MysqlController.LXCustomDebt
                {
                    DebtDate =
                        dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                        dtpTime.Value.Day.ToString().PadLeft(2, '0'),
                    DebtCustom  = txtMaster.Text,
                    DebtDetail  = txtName.Text,
                    DebtPrice   = double.Parse(txtCash.Text),
                    DebtisFix   = false,
                    DebtType    = cmbPayment.SelectedIndex,
                    DebtFixDate =
                        dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                        dtpTime.Value.Day.ToString().PadLeft(2, '0'),
                    DebtisInCircle = ckbinCircle.Checked
                };
                isBusy.Visible = true;
                DelegateAddCustomDebt dn = MysqlControl.AddCustomDebt;

                IAsyncResult iar = dn.BeginInvoke(iCustemDebt, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);
                isBusy.Visible = false;
                if (iResult.isSuccess)
                {
                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"增加客户欠款记录" + txtMaster + txtName + txtCash;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    MessageBox.Show(Resources.frmCustomDebt_cmdAdd_Click_添加客户欠款成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    CleanUI();
                    RefreshCustom(dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                  dtpTime.Value.Day.ToString().PadLeft(2, '0'), false);
                }
                else
                {
                    MessageBox.Show(Resources.frmCustomDebt_cmdAdd_Click_添加客户欠款失败_失败原因_ + iResult.ErrDesc,
                                    Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            cmdAdd.Enabled = true;
        }
예제 #13
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            isBusy.Visible = true;

            if (txtName.Text == "" || txtCash.Text == "" || cmbPayType.SelectedIndex == -1)
            {
                return;
            }


            if (!Regex.IsMatch(txtCash.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmPrivatePay_cmdAdd_Click_请正确填写金额_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            cmdAdd.Enabled = false;

            if (MessageBox.Show(
                    "是否确认如下递交内容?\r\n私人支出项目:" + txtName.Text + "\r\n支出时间:" + dtpTime.Value.Year +
                    dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                    dtpTime.Value.Day.ToString().PadLeft(2, '0') + "\r\n支出金额:" + txtCash.Text + "元\r\n支出类型:" +
                    cmbPayType.Text + "\r\n备注:" + txtBackup.Text, Application.ProductName, MessageBoxButtons.OKCancel) ==
                DialogResult.OK)
            {
                var iPayout = new MysqlController.Payout
                {
                    PayoutBackup = txtBackup.Text,
                    PayoutName   = txtName.Text,
                    PayoutPrice  = txtCash.Text,
                    PayoutType   = cmbPayType.SelectedIndex.ToString(),
                    PayoutInCase = ckbisInCash.Checked
                };
                if (cmbPayType.SelectedIndex == 2)
                {
                    iPayout.PayoutPrice = "-" + iPayout.PayoutPrice;
                }

                iPayout.PayoutDate = dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                     dtpTime.Value.Day.ToString().PadLeft(2, '0');

                DelegateAddPrivatePayout dn = MysqlControl.AddPrivatePayout;

                IAsyncResult iar = dn.BeginInvoke(iPayout, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    MessageBox.Show(Resources.frmPayout_cmdAdd_Click_添加支出记录成功, Application.ProductName,
                                    MessageBoxButtons.OK);
                    CleanUI();
                    RefreshPayout();
                }
                else
                {
                    MessageBox.Show(Resources.frmPayout_cmdAdd_Click_ + iResult.ErrDesc, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            cmdAdd.Enabled = true;
            isBusy.Visible = false;
        }
예제 #14
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            cmdDelete.Enabled = false;

            try
            {
                for (int i = 0; i < lsvDebt.SelectedItems.Count; i++)
                {
                    int tempID = int.Parse(lsvDebt.SelectedItems[i].Text);

                    isBusy.Visible = true;

                    DelegateDeleteCustomDebt dn = MysqlControl.DeleteCustomDebt;

                    IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                    while (iar.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                    isBusy.Visible = false;

                    if (iResult.isSuccess)
                    {
                        var iLog = new clsLog.LogPart();

                        iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                       DateTime.Now.Day.ToString().PadLeft(2, '0');
                        iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                        iLog.LogUser   = iLoginUser;
                        iLog.LogDetail = @"删除客户欠款 编号为:" + tempID;

                        DelegateAddLog dnlog = LogControl.AddLog;

                        IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                        while (iarlog.IsCompleted == false)
                        {
                            Application.DoEvents();
                        }

                        dnlog.EndInvoke(iarlog);

                        MessageBox.Show(Resources.frmCustomDebt_cmdDelete_Click_删除指定欠款成功_, Application.ProductName,
                                        MessageBoxButtons.OK);
                        RefreshCustom(iSavestrDate, false);
                    }
                    else
                    {
                        MessageBox.Show(Resources.frmCustomDebt_cmdDelete_Click_删除指定欠款失败__错误原因_ + iResult.ErrDesc,
                                        Application.ProductName,
                                        MessageBoxButtons.OK);
                    }
                }
            }
            catch (Exception)
            {
                cmdDelete.Enabled = true;
                return;
            }

            cmdDelete.Enabled = true;
        }
예제 #15
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            //这里判断输入值正确性


            if (txtPrice.Text == "" || !Regex.IsMatch(txtPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmEquipSell_cmdAdd_Click_请填写正确的配件销售价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtRealPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmEquipSell_cmdAdd_Click_请填写正确的配件成本价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtName.Text == "")
            {
                MessageBox.Show(Resources.frmEquipSell_cmdAdd_Click_请填写正确的配件名称_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            cmdAdd.Enabled = false;

            if (MessageBox.Show(
                    "是否确认如下递交内容?\r\n配件名目:" + txtName.Text + "\r\n销售时间:" + dtpTime.Value.Year +
                    dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                    dtpTime.Value.Day.ToString().PadLeft(2, '0') + "\r\n销售价格:" + txtPrice.Text + "元\r\n实际成本:" +
                    txtRealPrice.Text + "元\r\n供货商:" + txtSupplier.Text + "\r\n销售人:" + cmbSeller.Text + "\r\n支付类型:" +
                    cmbPayment.Text + "\r\n备注:" +
                    txtBackup.Text, Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                isBusy.Visible = true;
                var tempEquip = new MysqlController.LXEquip
                {
                    EquipDate =
                        dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                        dtpTime.Value.Day.ToString().PadLeft(2, '0'),
                    EquipBackup    = txtBackup.Text,
                    EquipName      = txtName.Text,
                    EquipPrice     = double.Parse(txtPrice.Text),
                    EquipRealPrice = double.Parse(txtRealPrice.Text),
                    EquipSellers   = cmbSeller.Text,
                    EquipSupplier  = txtSupplier.Text,
                    EquipPayment   = cmbPayment.SelectedIndex,
                    EquipBuyer     = txtEquipBuyer.Text
                };

                DelegateAddSellEquip dn = MysqlControl.AddSellEquip;

                IAsyncResult iar = dn.BeginInvoke(tempEquip, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    if (cmbPayment.SelectedIndex != 0)
                    {
                        var iCustomDebt = new MysqlController.LXCustomDebt
                        {
                            DebtCustom = txtName.Text,
                            DebtType   = cmbPayment.SelectedIndex - 1,
                            DebtDate   =
                                dtpTime.Value.Year +
                                dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                dtpTime.Value.Day.ToString().PadLeft(2, '0'),
                            DebtDetail  = "购买配件:" + txtName.Text + " 备注:" + txtBackup.Text,
                            DebtisFix   = false,
                            DebtEquipID = iResult.PhoneID,
                            DebtPrice   =
                                Math.Round(
                                    double.Parse(txtPrice.Text) - double.Parse(txtUnDebt.Text), 2),
                            DebtFixDate =
                                DateTime.Now.Year +
                                DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                DateTime.Now.Day.ToString().PadLeft(2, '0'),
                            DebtisInCircle = true,
                        };
                        var iDResult = new MysqlController.ReturnResult {
                            isSuccess = false
                        };
                        while (!iDResult.isSuccess)
                        {
                            DelegateAddCustomDebt dn1 = MysqlControl.AddCustomDebt;

                            IAsyncResult iar1 = dn1.BeginInvoke(iCustomDebt, null, null);

                            while (iar1.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            iDResult = dn1.EndInvoke(iar1);
                        }
                    }

                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"增加配件销售记录:" + txtName.Text + "销售时间:" + dtpTime.Value.Year +
                                     dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                     dtpTime.Value.Day.ToString().PadLeft(2, '0');

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);


                    isBusy.Visible = false;


                    MessageBox.Show(Resources.frmEquipSell_cmdAdd_Click_添加配件销售记录成功_已经成功添加 + txtName.Text,
                                    Application.ProductName, MessageBoxButtons.OK);
                    CleanUI();
                    RefreshPayout();
                }
                else
                {
                    isBusy.Visible = false;
                    MessageBox.Show(Resources.frmEquipSell_cmdAdd_Click_添加配件销售记录失败_错误原因_ + iResult.ErrDesc,
                                    Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            isBusy.Visible = false;
            cmdAdd.Enabled = true;
        }
예제 #16
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            if (txtCash.Text == "" || !Regex.IsMatch(txtCash.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmMarketDebt_cmdAdd_Click_请填写正确的市场欠款金额_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtMaster.Text == "")
            {
                MessageBox.Show(Resources.frmMarketDebt_cmdAdd_Click_请填写正确的市场欠款债权人_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtName.Text == "")
            {
                MessageBox.Show(Resources.frmMarketDebt_cmdAdd_Click_请填写正确的市场欠款事项_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            cmdAdd.Enabled = false;
            isBusy.Visible = true;

            if (MessageBox.Show(
                    "是否确认如下递交内容?\r\n欠款事项:" + txtName.Text + "\r\n欠款时间:" + dtpTime.Value.Year +
                    dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                    dtpTime.Value.Day.ToString().PadLeft(2, '0') + "\r\n欠款金额:" + txtCash.Text + "元\r\n经办人:" +
                    cmbSellers.Text + "\r\n备注:" + txtBackup.Text, Application.ProductName, MessageBoxButtons.OKCancel) ==
                DialogResult.OK)
            {
                var iMarketDebt = new MysqlController.LXMarketDebt
                {
                    DebtDate =
                        dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                        dtpTime.Value.Day.ToString().PadLeft(2, '0'),
                    DebtMaster       = txtMaster.Text,
                    DebtDetail       = txtName.Text,
                    DebtPrice        = double.Parse(txtCash.Text),
                    DebtSeller       = cmbSellers.Text,
                    DebtBackup       = txtBackup.Text,
                    DebtisCashCircle = ckbInCircle.Checked,
                    DebtFixDate      =
                        dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                        dtpTime.Value.Day.ToString().PadLeft(2, '0')
                };

                if (rbisDebt.Checked)
                {
                    iMarketDebt.DebtisFix = false;
                    //iMarketDebt.DebtFixDate = dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                    //                          dtpTime.Value.Day.ToString().PadLeft(2, '0');
                }
                else
                {
                    iMarketDebt.DebtisFix   = true;
                    iMarketDebt.DebtFixDate = dtpAddFixDate.Value.Year +
                                              dtpAddFixDate.Value.Month.ToString().PadLeft(2, '0') +
                                              dtpAddFixDate.Value.Day.ToString().PadLeft(2, '0');
                }

                DelegateAddMarketDebt dn = MysqlControl.AddMarketDebt;

                IAsyncResult iar = dn.BeginInvoke(iMarketDebt, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    isBusy.Visible = true;
                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"添加市场欠款:" + txtName.Text + "欠款时间:" + dtpTime.Value.Year +
                                     dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                     dtpTime.Value.Day.ToString().PadLeft(2, '0') + "欠款金额:" + txtCash.Text;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    isBusy.Visible = false;

                    MessageBox.Show(Resources.frmMarketDebt_cmdAdd_Click_添加市场欠款成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    CleanUI();
                    RefreshMarketDebt(dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                      dtpTime.Value.Day.ToString().PadLeft(2, '0'));
                }
                else
                {
                    MessageBox.Show(Resources.frmMarketDebt_cmdAdd_Click_添加市场欠款失败__错误原因_ + iResult.ErrDesc,
                                    Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            cmdAdd.Enabled = true;
            isBusy.Visible = false;
        }
예제 #17
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            if (txtCash.Text == "" || !Regex.IsMatch(txtCash.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmBinPhone_cmdAdd_Click_请填写正确的手机收取价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRepairPrice.Text == "" || !Regex.IsMatch(txtRepairPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmBinPhone_cmdAdd_Click_请填写正确的手机维修价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtName.Text == "")
            {
                MessageBox.Show(Resources.frmBinPhone_cmdAdd_Click_请填写正确的手机名称_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtIMEI.Text == "")
            {
                MessageBox.Show(Resources.frmBinPhone_cmdAdd_Click_请填写正确的手机IMEI_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            cmdAdd.Enabled = false;

            if (MessageBox.Show(
                    "是否确认如下递交内容?\r\n收取手机:" + txtName.Text + "\r\n收取时间:" + dtpTime.Value.Year +
                    dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                    dtpTime.Value.Day.ToString().PadLeft(2, '0') + "\r\n收取金额:" + txtCash.Text + "元\r\n维修金额:" +
                    txtRepairPrice.Text + "元\r\n手机串号:" + txtIMEI.Text + "\r\n经办人:" + cmbSellers.Text + "\r\n备注:" +
                    txtBackup.Text, Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                var iPhone = new MysqlController.RefundPhone
                {
                    RefundBackup = txtBackup.Text,
                    RefundDate   = dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                   dtpTime.Value.Day.ToString().PadLeft(2, '0'),
                    RefundFixCommision = 0,
                    RefundFixPrice     = 0,
                    RefundFixProfit    = 0,
                    RefundFixDate      = "",
                    RefundIMEI         = txtIMEI.Text,
                    RefundIsFix        = false,
                    RefundName         = txtName.Text,
                    RefundPrice        = double.Parse(txtCash.Text),
                    RefundRepairPrice  = double.Parse(txtRepairPrice.Text),
                    RefundSeller       = cmbSellers.Text,
                    RefundRefundType   = cmbBinType.SelectedIndex
                };
                isBusy.Visible = true;
                DelegateAddRefundPhone dn = MysqlControl.AddRefundPhone;

                IAsyncResult iar = dn.BeginInvoke(iPhone, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);
                isBusy.Visible = false;
                if (iResult.isSuccess)
                {
                    isBusy.Visible = true;
                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"添加用户手机返收:" + txtName.Text + "收取时间:" + dtpTime.Value.Year +
                                     dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                     dtpTime.Value.Day.ToString().PadLeft(2, '0') + "收取金额:" + txtCash.Text + "元";

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    isBusy.Visible = false;

                    MessageBox.Show(Resources.frmBinPhone_cmdAdd_Click_添加二手机回收完成_已成功添加_ + txtName.Text,
                                    Application.ProductName, MessageBoxButtons.OK);
                    CleanUI();
                    RefreshPayout(0, dtpTime.Value.Year + dtpTime.Value.Month.ToString().PadLeft(2, '0') +
                                  dtpTime.Value.Day.ToString().PadLeft(2, '0'), false);
                }
                else
                {
                    MessageBox.Show(Resources.frmBinPhone_cmdAdd_Click_添加二手机回收失败_失败原因_ + iResult.ErrDesc,
                                    Application.ProductName, MessageBoxButtons.OK);
                }
            }
            cmdAdd.Enabled = true;
        }
예제 #18
0
        private void cmdFix_Click(object sender, EventArgs e)
        {
            isBusy.Visible = true;
            cmdFix.Enabled = false;
            try
            {
                int tempID = int.Parse(lsvMarketDebt.SelectedItems[0].Text);

                DelegateFixMarketDebt dn = MysqlControl.FixMarketDebt;

                IAsyncResult iar = dn.BeginInvoke(tempID.ToString(),
                                                  dtpFixDate.Value.Year +
                                                  dtpFixDate.Value.Month.ToString().
                                                  PadLeft(2, '0') +
                                                  dtpFixDate.Value.Day.ToString().
                                                  PadLeft(2, '0'), null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    isBusy.Visible = true;
                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"更新市场欠款 编号为:" + tempID;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    isBusy.Visible = false;

                    MessageBox.Show(Resources.frmMarketDebt_cmdFix_Click_指定的市场结款成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    RefreshMarketDebt(iSavestrDate);
                }
                else
                {
                    MessageBox.Show(Resources.frmMarketDebt_cmdFix_Click_指定的市场结款失败_失败原因_ + iResult.ErrDesc,
                                    Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
                cmdFix.Enabled = true;
                return;
            }
            cmdFix.Enabled = true;
            isBusy.Visible = false;
        }
예제 #19
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            cmdDelete.Enabled = false;
            isBusy.Visible    = true;
            try
            {
                int iPhone = int.Parse(lsvPhones.SelectedItems[0].Text);

                DelegateDeleteRefundPhone dn = MysqlControl.DeleteRefundPhone;

                IAsyncResult iar = dn.BeginInvoke(iPhone, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    isBusy.Visible = true;

                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"删除用户手机返收 编号为:" + iPhone;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    isBusy.Visible = false;

                    MessageBox.Show(Resources.frmBinPhone_cmdDelete_Click_删除二手机回收完成_已成功添加_,
                                    Application.ProductName, MessageBoxButtons.OK);
                    CleanUI();
                    RefreshPayout(iSaveType, iSavestrDate, iSaveisSold);
                }
                else
                {
                    MessageBox.Show(Resources.frmBinPhone_cmdDelete_Click_删除二手机回收失败_失败原因_ + iResult.ErrDesc,
                                    Application.ProductName, MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdDelete.Enabled = true;
                return;
            }
            isBusy.Visible    = false;
            cmdDelete.Enabled = true;
        }
예제 #20
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            cmdEdit.Enabled = false;
            try
            {
                int tempID = int.Parse(lsvPhones.SelectedItems[0].Text);
                if (tempID.ToString() != "")
                {
                    var iAdd = new frmEditSellEditor {
                        Location = lsvPhones.Location
                    };

                    Point p = PointToScreen(lsvPhones.Location);

                    iAdd.SetDesktopBounds(p.X + groupBox2.Location.X + groupBox1.Location.X,
                                          p.Y + groupBox2.Location.Y + groupBox1.Location.Y, iAdd.Width,
                                          iAdd.Height);
                    isBusy.Visible = true;
                    DelegateReadPhoneByID dn1 = MysqlControl.ReadPhoneByID;

                    IAsyncResult iar1 = dn1.BeginInvoke(tempID.ToString(), null, null);

                    while (iar1.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    iAdd.iPhone    = dn1.EndInvoke(iar1);
                    isBusy.Visible = false;
                    if (iAdd.ShowDialog() == DialogResult.OK)
                    {
                        isBusy.Visible = true;

                        DelegateEditPhoneSell dn = MysqlControl.EditPhoneSell;

                        IAsyncResult iar = dn.BeginInvoke(iAdd.iPhone, null, null);

                        while (iar.IsCompleted == false)
                        {
                            Application.DoEvents();
                        }

                        MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                        if (iResult.isSuccess)
                        {
                            isBusy.Visible = true;

                            //同时修改客户欠款


                            isBusy.Visible = false;

                            MessageBox.Show("修改销售记录成功!", Application.ProductName, MessageBoxButtons.OK);
                            RefreshCustom(dtpDaily.Value.Year + dtpDaily.Value.Month.ToString().PadLeft(2, '0') +
                                          dtpDaily.Value.Day.ToString().PadLeft(2, '0'));
                        }
                        else
                        {
                            MessageBox.Show("修改销售记录失败!错误原因" + iResult.ErrDesc, Application.ProductName,
                                            MessageBoxButtons.OK);
                        }
                    }
                }
            }
            catch (Exception)
            {
                isBusy.Visible  = false;
                cmdEdit.Enabled = true;
                return;
            }
            isBusy.Visible  = false;
            cmdEdit.Enabled = true;
        }
예제 #21
0
        private void cmdUpdate_Click(object sender, EventArgs e)
        {
            if (!chkChangeWarranty.Checked)
            {
                return;
            }
            isBusy.Visible    = true;
            cmdUpdate.Enabled = false;

            tempPhone[cmbBuyer.SelectedIndex].PhoneWarranty         = true;
            tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyType     = cmbWarrantyType.SelectedIndex;
            tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyDuration = cmbWarrantyDuration.SelectedIndex;
            tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyDate     = dtpWarrantyStartDate.Value.Year +
                                                                      dtpWarrantyStartDate.Value.Month.ToString().PadLeft(
                2, '0') +
                                                                      dtpWarrantyStartDate.Value.Day.ToString().PadLeft(2,
                                                                                                                        '0');

            DelegateUpdatePhoneWarrantyByID dn = MysqlControl.UpdatePhoneWarrantyByID;

            IAsyncResult iar = dn.BeginInvoke(tempPhone[cmbBuyer.SelectedIndex], null, null);

            while (iar.IsCompleted == false)
            {
                Application.DoEvents();
            }

            MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

            if (iResult.isSuccess)
            {
                MessageBox.Show(Resources.frmEditPhone_cmdUpdate_Click_修改手机保修成功_, Application.ProductName,
                                MessageBoxButtons.OK);
                txtPhoneWarranty.Text = tempPhone[cmbBuyer.SelectedIndex].PhoneWarranty ? "有" : "无";
                txtWarrantDate.Text   = tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyDate.Substring(0, 4) +
                                        Resources.frmEditPhone_cmdSearch_Click_年 +
                                        tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyDate.Substring(4, 2) +
                                        Resources.frmEditPhone_cmdSearch_Click_月 +
                                        tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyDate.Substring(6, 2) +
                                        Resources.frmEditPhone_cmdSearch_Click_日;
                switch (tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyType.ToString())
                {
                case "0":
                    txtPhoneWarrantyType.Text = Resources.frmEditPhone_cmdSearch_Click_软件保修;
                    break;

                case "1":
                    txtPhoneWarrantyType.Text = Resources.frmEditPhone_cmdSearch_Click_软硬全保;
                    break;

                case "2":
                    txtPhoneWarrantyType.Text = Resources.frmEditPhone_cmdSearch_Click_延长保修;
                    break;

                case "3":
                    txtPhoneWarrantyType.Text = Resources.frmEditPhone_cmdSearch_Click_无敌保修;
                    break;
                }
                switch (tempPhone[cmbBuyer.SelectedIndex].PhoneWarrantyDuration.ToString())
                {
                case "0":
                    txtPhoneWarrantyDuration.Text = Resources.frmEditPhone_cmdSearch_Click_一年;
                    break;

                case "1":
                    txtPhoneWarrantyDuration.Text = Resources.frmEditPhone_cmdSearch_Click_两年;
                    break;

                case "2":
                    txtPhoneWarrantyDuration.Text = Resources.frmEditPhone_cmdSearch_Click_三年;
                    break;

                case "3":
                    txtPhoneWarrantyDuration.Text = Resources.frmEditPhone_cmdSearch_Click_终身;
                    break;
                }
            }
            else
            {
                MessageBox.Show(Resources.frmEditPhone_cmdUpdate_Click_ + iResult.ErrDesc, Application.ProductName,
                                MessageBoxButtons.OK);
            }
            cmdUpdate.Enabled = true;
            isBusy.Visible    = false;
        }
예제 #22
0
        private void cmdAddUser_Click(object sender, EventArgs e)
        {
            var tempUser  = new MysqlController.LXUser();
            var tempPhone = new MysqlController.LXPhones[1];

            tempPhone[0].PhoneBrand     = cmbPhoneBrand.SelectedIndex.ToString();
            tempPhone[0].PhoneIMEI      = txtPhoneIMEI.Text;
            tempPhone[0].PhoneName      = cmbPhoneName.Text;
            tempPhone[0].PhonePrice     = txtPhonePrice.Text;
            tempPhone[0].PhoneRealPrice = txtRealPrice.Text;
            tempPhone[0].PhoneSeller    = cmbSeller.SelectedIndex.ToString();
            tempPhone[0].PhoneHasEquip  = ckbEquip.Checked;
            tempPhone[0].PhoneDate      = dtpBuyPhone.Value.Year + dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                                          dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0');
            tempPhone[0].PhoneHasWarranty      = ckbWarranty.Checked;
            tempPhone[0].PhoneWarrantyType     = cmbWarrantyType.SelectedIndex.ToString();
            tempPhone[0].PhoneWarrantyDuration = cmbWarrantyDuration.SelectedIndex.ToString();
            tempPhone[0].PhoneWarrantyDate     = tempPhone[0].PhoneDate;
            tempPhone[0].PhoneIsDelete         = false;
            tempPhone[0].phone_supplier        = txtSupplier.Text;
            tempPhone[0].PhoneEquipPrice       = txtEquipPrice.Text;
            tempPhone[0].PhoneEquipRealPrice   = txtEquipRealPrice.Text;
            tempPhone[0].PhoneIsLegal          = ckbisLegal.Checked;
            tempPhone[0].PhoneIsHKLegal        = ckbisHKLegal.Checked;
            tempPhone[0].PhoneIsUnLegal        = ckbisUnLegal.Checked;
            tempPhone[0].PhoneWarrantyPrice    = txtWarrantyPrice.Text;
            tempUser.BuyPhones      = tempPhone;
            tempUser.Email          = txtEmail.Text;
            tempUser.BXKid          = txtBXKid.Text;
            tempUser.ContectAddress = txtContectAddress.Text;
            tempUser.haveBXK        = ckbBXK.Checked;
            tempUser.LXCredit       = txtPhonePrice.Text;

            tempUser.Phone     = txtPhone.Text;
            tempUser.QQ        = txtQQ.Text;
            tempUser.UserCName = txtUserCName.Text;
            tempUser.UserName  = txtUserName.Text;
            tempUser.UserTip   = txtUserTip.Text;
            tempUser.Telephone = txtTelephone.Text;
            tempUser.userType  = cmbType.SelectedIndex;

            switch (cmbGroup.SelectedIndex)
            {
            case 0:
                tempUser.GroupID = 15;
                break;

            case 1:
                tempUser.GroupID = 16;
                break;

            case 2:
                tempUser.GroupID = 17;
                break;

            case 3:
                tempUser.GroupID = 18;
                break;

            default:
                tempUser.GroupID = 0;
                break;
            }

            tempUser.Birthday = dtpBirthday.Value.Year + dtpBirthday.Value.Month.ToString().PadLeft(2, '0') +
                                dtpBirthday.Value.Day.ToString().PadLeft(2, '0');
            //首先检测数据

            if (txtPhone.Text == "" || !Regex.IsMatch(txtPhone.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机号码_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            //txtUnDebt

            if (txtUnDebt.Text == "" || !Regex.IsMatch(txtUnDebt.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的已支付款额_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtPhonePrice.Text == "" || !Regex.IsMatch(txtPhonePrice.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机销售价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtRealPrice.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机成本价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtPhoneIMEI.Text == "")
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机IMEI_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtEquipPrice.Text == "" || !Regex.IsMatch(txtEquipPrice.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的配件销售价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtEquipRealPrice.Text == "" || !Regex.IsMatch(txtEquipRealPrice.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的配件成本价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtWarrantyPrice.Text == "" || !Regex.IsMatch(txtWarrantyPrice.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的保修卡销售价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (ckbBXK.Checked && txtBXKid.Text == "")
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_已经勾选保修卡_但未填写保修卡编号_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (cmbPhoneBrand.SelectedIndex == -1)
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请选择正确的生产厂商_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            if (cmbPhoneName.SelectedIndex == -1)
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请选择正确的手机型号_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            if (cmbSeller.SelectedIndex == -1)
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请选择正确的销售人员_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (
                MessageBox.Show(
                    "是否确认递交以下内容?\r\n客户名称:" + txtUserCName.Text + "\r\n手机号码:" + txtPhone.Text + "\r\n保修卡:" +
                    txtBXKid.Text + "\r\n购机时间:" + dtpBuyPhone.Value.Year +
                    dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                    dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0') + "\r\n手机品牌:" + cmbPhoneBrand.Text + "\r\n手机型号:" +
                    cmbPhoneName.Text + "\r\n手机购买价格:" + txtPhonePrice.Text + "\r\n实际成本:" + txtRealPrice.Text +
                    "\r\n销售人员:" + cmbSeller.Text + "\r\n手机串号:" + txtPhoneIMEI.Text + "\r\n供应商:" + txtSupplier.Text,
                    Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                //这里进行手机号验证;
                isBusy.Visible = true;

                DelegateGetSingleUser dn = MysqlControl.GetSingleUser;

                IAsyncResult iar = dn.BeginInvoke("", txtPhone.Text, "", null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnUsers tempUsers = dn.EndInvoke(iar);

                if (tempUsers.UserNum > 0)
                {
                    isBusy.Visible = false;

                    string BuyPhone = "";
                    for (int i = 0; i < tempUsers.UserInfo[0].BuyPhones.Length; i++)
                    {
                        BuyPhone = BuyPhone + "\r\n" + tempUsers.UserInfo[0].BuyPhones[i].PhoneName;
                    }
                    if (
                        MessageBox.Show(
                            Resources.frmNewCustom_cmdAddUser_Click_已经存在该用户_将跳转到用户修改页面进行操作_ + "\r\n用户详细信息:\r\n" +
                            tempUsers.UserInfo[0].UserCName + "\r\n手机号码:" + tempUsers.UserInfo[0].Phone + "\r\n保修卡号:" +
                            tempUsers.UserInfo[0].BXKid + "\r\n已经购买手机:" + BuyPhone, Application.ProductName,
                            MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        var iCustem = new frmEditCustem(isBusy, iLoginUser)
                        {
                            TopLevel = false, Dock = DockStyle.Fill, Parent = Parent
                        };
                        iCustem.SetCustom(tempUsers.UserInfo[0]);
                        iCustem.Show();
                        iCustem.BringToFront();
                        Parent.BringToFront();

                        iCustem.AddPhone(tempPhone[0], cmbPayment.SelectedIndex, txtUnDebt.Text);

                        return;
                    }
                }

                //正常添加
                cmdAddUser.Enabled = false;
                isBusy.Visible     = true;

                DelegateAddUser dnAdd = MysqlControl.AddUser;

                IAsyncResult iarAdd = dnAdd.BeginInvoke(tempUser, null, null);

                while (iarAdd.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dnAdd.EndInvoke(iarAdd);

                if (iResult.isSuccess)
                {
                    //这里去增加到客户欠款里
                    if (cmbPayment.SelectedIndex != 0)
                    {
                        var iDebt = new MysqlController.LXCustomDebt
                        {
                            DebtDate =
                                dtpBuyPhone.Value.Year +
                                dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                                dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0'),
                            DebtCustom = txtUserCName.Text,
                            DebtDetail = "购买手机:" + cmbPhoneBrand.Text + " - " + cmbPhoneName.Text,
                            DebtisFix  = false,
                            DebtPrice  = int.Parse(txtPhonePrice.Text) + int.Parse(txtEquipPrice.Text) +
                                         int.Parse(txtWarrantyPrice.Text) - int.Parse(txtUnDebt.Text),
                            DebtType = cmbPayment.SelectedIndex - 1
                        };

                        var iDResult = new MysqlController.ReturnResult {
                            isSuccess = false
                        };

                        while (!iDResult.isSuccess)
                        {
                            DelegateAddCustomDebt dnACD  = MysqlControl.AddCustomDebt;
                            IAsyncResult          iarACD = dnACD.BeginInvoke(iDebt, null, null);
                            while (iarACD.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }
                            iDResult = dnACD.EndInvoke(iarACD);
                        }
                    }

                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"添加客户:" + txtUserCName.Text;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_添加用户成功_已经添加用户_ + txtUserCName.Text,
                                    Application.ProductName, MessageBoxButtons.OK);
                    txtLastAdd.Text = Resources.frmNewCustom_cmdAddUser_Click_刚刚添加的用户为_ + txtUserCName.Text +
                                      Resources.frmNewCustom_cmdAddUser_Click___购买机型为 + cmbPhoneName.Text;

                    CleanUI();
                }
                else
                {
                    MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_ + iResult.ErrDesc, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            isBusy.Visible     = false;
            cmdAddUser.Enabled = true;
        }
예제 #23
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            if (cmbSellers.SelectedIndex == -1 || txtAskDuration.Text == "")
            {
                return;
            }

            if (txtAskDuration.Text == "" || !Regex.IsMatch(txtAskDuration.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show("请填写正确的请假时间!", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            cmdAdd.Enabled = false;
            isBusy.Visible = true;

            if (MessageBox.Show(
                    "是否确认如下递交内容?\r\n请假人员:" + cmbSellers.Text + "\r\n请假时间:" + dtpAskDate.Value.Year +
                    dtpAskDate.Value.Month.ToString().PadLeft(2, '0') +
                    dtpAskDate.Value.Day.ToString().PadLeft(2, '0') + "\r\n请假类型:" + cmbAskType.Text + "\r\n请假天数:" +
                    txtAskDuration.Text + "\r\n请假原因:" + txtAskResult.Text, Application.ProductName,
                    MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                var tempAsk = new MysqlController.AskForLeave
                {
                    AskDate =
                        dtpAskDate.Value.Year + dtpAskDate.Value.Month.ToString().PadLeft(2, '0') +
                        dtpAskDate.Value.Day.ToString().PadLeft(2, '0'),
                    AskSeller   = cmbSellers.Text,
                    AskType     = cmbAskType.SelectedIndex,
                    AskDuration = txtAskDuration.Text,
                    AskTip      = txtAskResult.Text
                };

                DelegateAddAsk dn = MysqlControl.AddAsk;

                IAsyncResult iar = dn.BeginInvoke(tempAsk, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    MessageBox.Show(Resources.frmAskforLeave_cmdAdd_Click_添加请假记录成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    CleanUI();
                    cmdSearch_Click(sender, e);
                }
                else
                {
                    MessageBox.Show(Resources.frmAskforLeave_cmdAdd_Click_ + iResult.ErrDesc, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            isBusy.Visible = false;
            cmdAdd.Enabled = true;
        }
예제 #24
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            try
            {
                cmdEdit.Enabled = false;
                string tempID = lsvPhones.SelectedItems[0].Text;
                if (tempID != "" && lsvPhones.SelectedItems[8].Text != "已销售")
                {
                    var iAdd = new frmBinPhonesEditor(isBusy)
                    {
                        Location = lsvPhones.Location
                    };

                    Point p = PointToScreen(lsvPhones.Location);
                    isBusy.Visible = true;
                    DelegateReadRefundPhoneByID dnr = MysqlControl.ReadRefundPhoneByID;

                    IAsyncResult iarr = dnr.BeginInvoke(tempID, null, null);

                    while (iarr.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    iAdd.iRefundPhone = dnr.EndInvoke(iarr);
                    isBusy.Visible    = false;
                    iAdd.SetDesktopBounds(p.X + groupBox2.Location.X, p.Y + groupBox2.Location.Y, iAdd.Width,
                                          iAdd.Height);
                    if (iAdd.ShowDialog() == DialogResult.OK)
                    {
                        isBusy.Visible = true;
                        DelegateEditRefundPhone dn = MysqlControl.EditRefundPhone;

                        IAsyncResult iar = dn.BeginInvoke(iAdd.iRefundPhone, null, null);

                        while (iar.IsCompleted == false)
                        {
                            Application.DoEvents();
                        }

                        MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                        if (iResult.isSuccess)
                        {
                            isBusy.Visible = true;

                            var iLog = new clsLog.LogPart();

                            iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                           DateTime.Now.Day.ToString().PadLeft(2, '0');
                            iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                            iLog.LogUser   = iLoginUser;
                            iLog.LogDetail = @"修改用户返收手机,编号为:" + tempID;

                            DelegateAddLog dnlog = LogControl.AddLog;

                            IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                            while (iarlog.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            dnlog.EndInvoke(iarlog);

                            isBusy.Visible = false;

                            MessageBox.Show("修改回收手机记录成功!", Application.ProductName, MessageBoxButtons.OK);
                            RefreshPayout(iSaveType, iSavestrDate, iSaveisSold);
                        }
                        else
                        {
                            MessageBox.Show("修改回收手机记录失败!错误原因" + iResult.ErrDesc, Application.ProductName,
                                            MessageBoxButtons.OK);
                        }
                        isBusy.Visible = false;
                    }
                }
            }
            catch (Exception)
            {
                isBusy.Visible  = false;
                cmdEdit.Enabled = true;
                return;
            }
            isBusy.Visible  = false;
            cmdEdit.Enabled = true;
        }
예제 #25
0
        private void cmdUpdate_Click(object sender, EventArgs e)
        {
            cmdUpdate.Enabled = false;
            isBusy.Visible    = true;
            try
            {
                int    RefundID       = int.Parse(lsvPhones.SelectedItems[0].Text);
                double RefundFixPrice = 0;
                try
                {
                    RefundFixPrice = double.Parse(lsvPhones.SelectedItems[0].SubItems[10].Text);
                }
                catch (Exception)
                {
                    RefundFixPrice = 0;
                }
                string FixDate = "";
                if (ckbisSold.Checked)
                {
                    FixDate = dtpFixDate.Value.Year +
                              dtpFixDate.Value.Month.ToString().PadLeft(2, '0') +
                              dtpFixDate.Value.Day.ToString().PadLeft(2, '0');
                }
                else
                {
                    RefundFixPrice = 0;
                    FixDate        = "";
                }


                DelegateFixRefundPhone dn = MysqlControl.FixRefundPhone;

                IAsyncResult iar = dn.BeginInvoke(ckbisSold.Checked, FixDate, RefundFixPrice,
                                                  RefundID, cmbSellType.SelectedIndex, cmbSellers.Text, null,
                                                  null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    isBusy.Visible = true;

                    if (cmbSellType.SelectedIndex != 0)
                    {
                        var iCustomDebt = new MysqlController.LXCustomDebt
                        {
                            DebtCustom = txtUserName.Text,
                            DebtType   = cmbSellType.SelectedIndex - 1,
                            DebtDate   =
                                dtpFixDate.Value.Year +
                                dtpFixDate.Value.Month.ToString().PadLeft(2, '0') +
                                dtpFixDate.Value.ToString().PadLeft(2, '0'),
                            DebtDetail = "购买二手机:" + txtUserName.Text,
                            DebtisFix  = false,
                            DebtBinID  = RefundID,
                            DebtPrice  =
                                Math.Round(
                                    double.Parse(txtFixPrice.Text) - double.Parse(txtUnDebt.Text),
                                    2),
                            DebtFixDate =
                                DateTime.Now.Year +
                                DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                DateTime.Now.Day.ToString().PadLeft(2, '0'),
                            DebtisInCircle = true
                        };
                        var iDResult = new MysqlController.ReturnResult {
                            isSuccess = false
                        };
                        while (!iDResult.isSuccess)
                        {
                            DelegateAddCustomDebt dn1 = MysqlControl.AddCustomDebt;

                            IAsyncResult iar1 = dn1.BeginInvoke(iCustomDebt, null, null);

                            while (iar1.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            iDResult = dn1.EndInvoke(iar1);
                        }
                    }

                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"更新用户手机返收记录 编号为" + RefundID;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    isBusy.Visible = false;

                    MessageBox.Show(
                        Resources.frmBinPhone_cmdUpdate_Click_修改二手机回收完成_已成功更改_ +
                        lsvPhones.SelectedItems[0].SubItems[2].Text,
                        Application.ProductName, MessageBoxButtons.OK);
                    //CleanUI();
                    RefreshPayout(iSaveType, iSavestrDate, iSaveisSold);
                }
                else
                {
                    MessageBox.Show(Resources.frmBinPhone_cmdUpdate_Click_修改二手机回收失败_失败原因_ + iResult.ErrDesc,
                                    Application.ProductName, MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdUpdate.Enabled = true;
                return;
            }
            isBusy.Visible    = false;
            cmdUpdate.Enabled = true;
        }
예제 #26
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            try
            {
                cmdEdit.Enabled = false;
                int tempID = int.Parse(lsvEquips.SelectedItems[0].Text);
                if (tempID.ToString() != "")
                {
                    var iAdd = new frmEquipSellEditor(isBusy)
                    {
                        Location = lsvEquips.Location
                    };

                    Point p = PointToScreen(lsvEquips.Location);

                    iAdd.SetDesktopBounds(p.X + groupBox2.Location.X, p.Y + groupBox2.Location.Y, iAdd.Width,
                                          iAdd.Height);

                    DelegateReadSoldEquipByID dn = MysqlControl.ReadSoldEquipByID;

                    IAsyncResult iar = dn.BeginInvoke(tempID.ToString(), null, null);

                    while (iar.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    iAdd.iEquip = dn.EndInvoke(iar);

                    if (iAdd.ShowDialog() == DialogResult.OK)
                    {
                        isBusy.Visible = true;

                        DelegateEditSoldEquip dn1 = MysqlControl.EditSoldEquip;

                        IAsyncResult iar1 = dn1.BeginInvoke(iAdd.iEquip, null, null);

                        while (iar1.IsCompleted == false)
                        {
                            Application.DoEvents();
                        }

                        MysqlController.ReturnResult iResult = dn1.EndInvoke(iar1);

                        if (iResult.isSuccess)
                        {
                            //同时修改客户欠款

                            var iLog = new clsLog.LogPart();

                            iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                           DateTime.Now.Day.ToString().PadLeft(2, '0');
                            iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                            iLog.LogUser   = iLoginUser;
                            iLog.LogDetail = @"修改配件销售,编号:" + tempID;

                            DelegateAddLog dnlog = LogControl.AddLog;

                            IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                            while (iarlog.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            dnlog.EndInvoke(iarlog);
                            MessageBox.Show("修改配件销售成功!", Application.ProductName, MessageBoxButtons.OK);
                            RefreshPayout();
                        }
                        else
                        {
                            MessageBox.Show("修改配件销售失败!错误原因" + iResult.ErrDesc, Application.ProductName,
                                            MessageBoxButtons.OK);
                        }
                        isBusy.Visible = false;
                    }
                }
            }
            catch (Exception)
            {
                cmdEdit.Enabled = true;
                isBusy.Visible  = false;
                return;
            }
            isBusy.Visible  = false;
            cmdEdit.Enabled = true;
        }
예제 #27
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            cmdDelete.Enabled = false;
            isBusy.Visible    = true;
            try
            {
                int tempID = int.Parse(lsvPayout.SelectedItems[0].SubItems[5].Text);

                DelegateDeletePayout dn = MysqlControl.DeletePayout;

                IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    isBusy.Visible = true;
                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"删除固定支出 编号为:" + tempID;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    isBusy.Visible = false;
                    MessageBox.Show(Resources.frmPayout_cmdDelete_Click_删除支出记录成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    RefreshPayout();
                }
                else
                {
                    MessageBox.Show(Resources.frmPayout_cmdDelete_Click_ + iResult.ErrDesc, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdDelete.Enabled = true;
                return;
            }
            isBusy.Visible    = false;
            cmdDelete.Enabled = true;
        }
예제 #28
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            isBusy.Visible    = true;
            cmdDelete.Enabled = false;
            try
            {
                int tempID = int.Parse(lsvEquips.SelectedItems[0].Text);

                DelegateDeleteSellEquip dn = MysqlControl.DeleteSellEquip;

                IAsyncResult iar = dn.BeginInvoke(tempID, null, null);

                while (iar.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dn.EndInvoke(iar);

                if (iResult.isSuccess)
                {
                    var iDResult = new MysqlController.ReturnResult {
                        isSuccess = false
                    };
                    while (!iDResult.isSuccess)
                    {
                        DelegateDeleteCustomDebtByEquipID dn1 = MysqlControl.DeleteCustomDebtByEquipID;

                        IAsyncResult iar1 = dn1.BeginInvoke(tempID, null, null);

                        while (iar1.IsCompleted == false)
                        {
                            Application.DoEvents();
                        }

                        iDResult = dn1.EndInvoke(iar1);
                    }

                    var iLog = new clsLog.LogPart();

                    iLog.LogDate = DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                   DateTime.Now.Day.ToString().PadLeft(2, '0');
                    iLog.LogTime   = DateTime.Now.Hour + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0');
                    iLog.LogUser   = iLoginUser;
                    iLog.LogDetail = @"删除配件销售记录编号:" + tempID;

                    DelegateAddLog dnlog = LogControl.AddLog;

                    IAsyncResult iarlog = dnlog.BeginInvoke(iLog, null, null);

                    while (iarlog.IsCompleted == false)
                    {
                        Application.DoEvents();
                    }

                    dnlog.EndInvoke(iarlog);

                    MessageBox.Show(Resources.frmEquipSell_cmdDelete_Click_删除指定配件销售记录成功_, Application.ProductName,
                                    MessageBoxButtons.OK);
                    RefreshPayout();
                }
                else
                {
                    MessageBox.Show(Resources.frmEquipSell_cmdDelete_Click_删除指定配件销售记录失败__错误原因_ + iResult.ErrDesc,
                                    Application.ProductName,
                                    MessageBoxButtons.OK);
                }
            }
            catch (Exception)
            {
                isBusy.Visible    = false;
                cmdDelete.Enabled = true;
                return;
            }
            isBusy.Visible    = false;
            cmdDelete.Enabled = true;
        }
예제 #29
0
        private void cmdAddUser_Click(object sender, EventArgs e)
        {
            //首先检测数据

            if (txtPhone.Text == "" || !Regex.IsMatch(txtPhone.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机号码_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtPhone2.Text != "" && !Regex.IsMatch(txtPhone2.Text.Trim(), @"^[0-9]+$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机号码_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            //txtUnDebt

            if (txtUnDebt.Text == "" || !Regex.IsMatch(txtUnDebt.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的已支付款额_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtPhonePrice.Text == "" || !Regex.IsMatch(txtPhonePrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机销售价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtRealPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机成本价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtScreenGuardPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的屏贴成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtBettaryPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的电池成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtSDCardPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的SD卡成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtShellPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的保护套成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtChargePrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的车载充电器成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtHeadPhonePrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的耳机成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtCardlePrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的车载支架成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtRealPrice.Text == "" || !Regex.IsMatch(txtOtherPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show("请填写正确的其他(赠品)成本价格", Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (txtPhoneIMEI.Text == "")
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的手机IMEI_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }


            if (txtWarrantyPrice.Text == "" || !Regex.IsMatch(txtWarrantyPrice.Text.Trim(), @"^(-?\d+)(\.\d+)?$"))
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请填写正确的保修卡销售价格_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (ckbWarranty.Checked && txtBXKid.Text == "")
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_已经勾选保修卡_但未填写保修卡编号_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (cmbPhoneBrand.SelectedIndex == -1)
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请选择正确的生产厂商_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            if (cmbPhoneName.SelectedIndex == -1)
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请选择正确的手机型号_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }
            if (cmbSeller.SelectedIndex == -1)
            {
                MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_请选择正确的销售人员_, Application.ProductName,
                                MessageBoxButtons.OK);
                return;
            }

            if (
                MessageBox.Show(
                    "是否确认递交以下内容?\r\n客户名称:" + txtUserCName.Text + "\r\n手机号码:" + txtPhone.Text + "\r\n保修卡:" +
                    txtBXKid.Text + "\r\n购机时间:" + dtpBuyPhone.Value.Year +
                    dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                    dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0') + "\r\n手机品牌:" + cmbPhoneBrand.Text + "\r\n手机型号:" +
                    cmbPhoneName.Text + "\r\n手机购买价格:" + txtPhonePrice.Text + "\r\n实际成本:" + txtRealPrice.Text +
                    "\r\n销售人员:" + cmbSeller.Text + "\r\n手机串号:" + txtPhoneIMEI.Text + "\r\n供应商:" + txtSupplier.Text,
                    Application.ProductName, MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                cmdAddUser.Enabled = false;
                isBusy.Visible     = true;

                var tempPhone = new MysqlController.LXSellPhone();

                tempPhone.PhoneBattery    = double.Parse(txtBettaryPrice.Text);
                tempPhone.PhoneBrandid    = cmbPhoneBrand.SelectedIndex;
                tempPhone.PhoneCarCharger = double.Parse(txtChargePrice.Text);
                tempPhone.PhoneCarCradle  = double.Parse(txtCardlePrice.Text);
                tempPhone.PhoneDate       = dtpBuyPhone.Value.Year + dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                                            dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0');
                tempPhone.PhoneHeadPhone         = double.Parse(txtHeadPhonePrice.Text);
                tempPhone.PhoneIMEI              = txtPhoneIMEI.Text;
                tempPhone.PhoneisDelete          = false;
                tempPhone.PhoneisHKLegal         = ckbisHKLegal.Checked;
                tempPhone.PhoneisLegal           = ckbisLegal.Checked;
                tempPhone.PhoneisUnLegal         = ckbisUnLegal.Checked;
                tempPhone.PhoneName              = cmbPhoneName.Text;
                tempPhone.PhoneOther             = double.Parse(txtOtherPrice.Text);
                tempPhone.PhonePayment           = cmbPayment.SelectedIndex;
                tempPhone.PhonePrice             = double.Parse(txtPhonePrice.Text);
                tempPhone.PhoneRealprice         = double.Parse(txtRealPrice.Text);
                tempPhone.PhoneScreenGuard       = double.Parse(txtScreenGuardPrice.Text);
                tempPhone.PhoneSDCARD            = double.Parse(txtSDCardPrice.Text);
                tempPhone.PhoneSeller            = cmbSeller.Text;
                tempPhone.PhoneShell             = double.Parse(txtShellPrice.Text);
                tempPhone.PhoneSupplier          = txtSupplier.Text;
                tempPhone.PhoneUserAddress       = txtContectAddress.Text;
                tempPhone.PhoneUserBXKid         = txtBXKid.Text;
                tempPhone.PhoneUsercellPhone     = txtPhone.Text;
                tempPhone.PhoneUsercellPhoneback = txtPhone2.Text;
                tempPhone.PhoneUseremail         = txtEmail.Text;
                tempPhone.PhoneUserName          = txtUserCName.Text;
                tempPhone.PhoneUserQQ            = txtQQ.Text;
                tempPhone.PhoneUserTelePhone     = txtTelephone.Text;
                tempPhone.PhoneUserTip           = txtUserTip.Text;
                tempPhone.PhoneUserType          = cmbType.SelectedIndex;
                tempPhone.PhoneWarranty          = ckbWarranty.Checked;
                tempPhone.PhoneWarrantyDate      = dtpBuyPhone.Value.Year +
                                                   dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                                                   dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0');
                tempPhone.PhoneWarrantyDuration = cmbWarrantyDuration.SelectedIndex;
                tempPhone.PhoneWarrantyPrice    = double.Parse(txtWarrantyPrice.Text);
                tempPhone.PhoneWarrantyType     = cmbWarrantyType.SelectedIndex;

                //DelegateAddNewSell
                DelegateAddNewSell dnAdd = MysqlControl.AddNewSell;

                IAsyncResult iarAdd = dnAdd.BeginInvoke(tempPhone, null, null);

                while (iarAdd.IsCompleted == false)
                {
                    Application.DoEvents();
                }

                MysqlController.ReturnResult iResult = dnAdd.EndInvoke(iarAdd);

                if (iResult.isSuccess)
                {
                    //添加新销售成功 需要处理客户欠款及其余收尾工作

                    //添加欠款

                    /*
                     * 现金支付
                     *  刷卡支付
                     *  欠款支付
                     *  支付宝
                     */
                    if (cmbPayment.SelectedIndex != 0)
                    {
                        var iCustomDebt = new MysqlController.LXCustomDebt
                        {
                            DebtCustom = txtUserCName.Text,
                            DebtType   = cmbPayment.SelectedIndex - 1,
                            DebtDate   =
                                dtpBuyPhone.Value.Year +
                                dtpBuyPhone.Value.Month.ToString().PadLeft(2, '0') +
                                dtpBuyPhone.Value.Day.ToString().PadLeft(2, '0'),
                            DebtDetail  = "购买手机:" + cmbPhoneName.Text + " 备注:" + txtUserTip.Text,
                            DebtisFix   = false,
                            DebtPhoneID = iResult.PhoneID,
                            DebtPrice   =
                                Math.Round(
                                    double.Parse(txtPhonePrice.Text) -
                                    double.Parse(txtUnDebt.Text), 2),
                            DebtFixDate =
                                DateTime.Now.Year +
                                DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                DateTime.Now.Day.ToString().PadLeft(2, '0'),
                            DebtisInCircle = true,
                        };
                        var iDResult = new MysqlController.ReturnResult {
                            isSuccess = false
                        };
                        while (!iDResult.isSuccess)
                        {
                            DelegateAddCustomDebt dn1 = MysqlControl.AddCustomDebt;

                            IAsyncResult iar1 = dn1.BeginInvoke(iCustomDebt, null, null);

                            while (iar1.IsCompleted == false)
                            {
                                Application.DoEvents();
                            }

                            iDResult = dn1.EndInvoke(iar1);
                        }
                    }

                    //扫尾工
                    MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_添加用户成功_已经添加用户_ + txtUserCName.Text,
                                    Application.ProductName, MessageBoxButtons.OK);
                    txtLastAdd.Text = Resources.frmNewCustom_cmdAddUser_Click_刚刚添加的用户为_ + txtUserCName.Text +
                                      Resources.frmNewCustom_cmdAddUser_Click___购买机型为 + cmbPhoneName.Text;
                    cmdClear_Click(sender, e);
                }
                else
                {
                    MessageBox.Show(Resources.frmNewCustom_cmdAddUser_Click_ + iResult.ErrDesc, Application.ProductName,
                                    MessageBoxButtons.OK);
                }
                isBusy.Visible     = false;
                cmdAddUser.Enabled = true;
            }
        }