private void frmMain_Load(object sender, EventArgs e) { ReadSetting(); panelDefault.Parent = this; panelFunctiron.Parent = this; panelFunctiron.Left = panelDefault.Left; panelFunctiron.Top = panelDefault.Top; panelDefault.BringToFront(); txtLoginUser.Text = LoginUser; 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 = LoginUser; iLog.LogDetail = @"成功登录CRM"; DelegateAddLog dn = LogControl.AddLog; IAsyncResult iar = dn.BeginInvoke(iLog, null, null); while (iar.IsCompleted == false) { Application.DoEvents(); } dn.EndInvoke(iar); if (LoginType) { return; } 利润核算ToolStripMenuItem.Visible = false; groupBox4.Visible = false; groupBox3.Visible = false; 其他功能ToolStripMenuItem.Visible = false; picDailySell.Visible = false; picDailyEquip.Visible = false; picReport.Visible = false; picTotel.Visible = false; picAskforLeave.Visible = false; picGoods.Visible = false; picSearchUser.Visible = false; picSalers.Visible = false; picSetting.Visible = false; }
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; }
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; }
//private delegate MysqlController.ReturnResult DelegateFixCustomDebt(string DebtID, string FixDate); private void cmdSplitFix_Click(object sender, EventArgs e) { cmdSplitFix.Enabled = false; try { if (lsvDebt.SelectedItems[0].SubItems[6].Text == "已到帐") { cmdSplitFix.Enabled = true; return; } int tempID = int.Parse(lsvDebt.SelectedItems[0].Text); var iAdd = new frmSplitDebt(isBusy) { Location = lsvDebt.Location }; MysqlController.LXCustomDebt[] iDebt = MysqlControl.ReadCustomDebt(tempID); if (iDebt != null || iDebt.Length > 0) { 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); iAdd.iDebt = iDebt[0]; if (iAdd.ShowDialog() == DialogResult.OK) { isBusy.Visible = true; MysqlController.ReturnResult iDResult; iDResult.isSuccess = false; while (iDResult.isSuccess != true) { DelegateChangeSplitDebt dn = MysqlControl.ChangeSplitDebt; IAsyncResult iar = dn.BeginInvoke(tempID.ToString(), double.Parse(iAdd.iUnFixPrice), null, null); while (iar.IsCompleted == false) { Application.DoEvents(); } iDResult = dn.EndInvoke(iar); } isBusy.Visible = false; if (int.Parse(iAdd.iUnFixPrice) == 0) { //已经没有欠款了.这里需要递交一次还款结束 iDResult.isSuccess = false; isBusy.Visible = true; while (iDResult.isSuccess != true) { DelegateFixCustomDebt dn = MysqlControl.FixCustomDebt; IAsyncResult iar = dn.BeginInvoke(tempID.ToString(), iAdd.iLastFixDate, cmbBackDebtType.SelectedIndex, txtBackDebtBackup.Text, null, null); while (iar.IsCompleted == false) { Application.DoEvents(); } iDResult = dn.EndInvoke(iar); } 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; } switch (iViewType) { case 0: RefreshCustom(dtpFromTime.Value.Year + dtpFromTime.Value.Month.ToString().PadLeft(2, '0') + dtpFromTime.Value.Day.ToString().PadLeft(2, '0'), false); break; case 1: RefreshCustom(dtpFromTime.Value.Year + dtpFromTime.Value.Month.ToString().PadLeft(2, '0'), false); break; case 2: RefreshCustom("20", false); break; } //lsvDebt.SelectedItems[0].SubItems[8].Text = "已到帐"; } } } catch (Exception) { cmdSplitFix.Enabled = true; return; } cmdSplitFix.Enabled = true; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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.frmPayout_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'); DelegateAddPayout dn = MysqlControl.AddPayout; IAsyncResult iar = dn.BeginInvoke(iPayout, 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.frmPayout_cmdAdd_Click_添加支出记录成功, Application.ProductName, MessageBoxButtons.OK); CleanUI(); RefreshPayout(); } else { MessageBox.Show(Resources.frmPayout_cmdAdd_Click_ + iResult.ErrDesc, Application.ProductName, MessageBoxButtons.OK); } } isBusy.Visible = false; cmdAdd.Enabled = true; }
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; }
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; }
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; }
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; }
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; }