private void BuyInForm_Load(object sender, EventArgs e) { MaterialManager mm = new MaterialManager(); StorageManager sm = new StorageManager(); SupplierManager sum = new SupplierManager(); _AllMaterial = mm.GetList(""); _AllStorage = sm.GetList(""); _AllSupplier = sum.SelSupplierTable(); //禁用自动创建列 dataGridView1.AutoGenerateColumns = false; dataGridViewFujia.AutoGenerateColumns = false; //初始化商品下拉列表 InitMaterialDataGridView(); //初始化datagridview InitDataGridView(); dataGridView1.DataSource = _AllMaterial.Tables[0]; //绑定事件 双击事填充内容并隐藏列表 dataGridView1.CellDoubleClick += DataGridView1_CellDoubleClick; dataGridViewFujia.CellDoubleClick += DataGridViewFujia_CellDoubleClick; //采购单单号 _BuyOdd = BuildCode.ModuleCode("BA"); textBoxOddNumbers.Text = _BuyOdd; InitSupplier(); }
private void form_save_Click(object sender, EventArgs e) { if (materialType == null) { MaterialTypeManager mtm = new MaterialTypeManager(); MaterialTypeForm clientForm = (MaterialTypeForm)this.Owner; MaterialType materialType = new MaterialType() { MT_Code = BuildCode.ModuleCode("MT"), MT_Name = textBox1.Text.Trim(), MT_ParentID = matype_code, MT_Clear = 1, MT_Enable = 1, MT_ID = 0 }; try { int result = mtm.Add(materialType); if (result > 0) { clientForm.Isflag = true; MessageBox.Show("产品类别:" + textBox1.Text + " \n添加成功"); Close(); } else { clientForm.Isflag = false; MessageBox.Show("添加失败,请重新添加"); Close(); } } catch (Exception ex) { MessageBox.Show("商品插入异常:" + ex.Message); Close(); } } else { MaterialTypeManager mtm = new MaterialTypeManager(); try { if (mtm.UpdateByCode(materialType)) { MessageBox.Show("更改成功!"); Close(); } else { MessageBox.Show("更改失败,请检查服务器连接"); Close(); } } catch (Exception ex) { MessageBox.Show("更改错误,请检查服务器连接.异常:" + ex.Message); Close(); } } }
private void BuyPaymentForm_Load(object sender, EventArgs e) { try { //绑定采购明细 DataTable dt = ch.DataTableReCoding(bpm.SelEmp(" buy.Buy_Code='" + XYEEncoding.strCodeHex(_buycode) + "'").Tables[0]); superGridControl1.PrimaryGrid.DataSource = dt; superGridControl1.PrimaryGrid.AllowEdit = false; LoginInfomation l = LoginInfomation.getInstance(); l.UserName = "******"; ltxt_operation.Text = l.UserName; txt_yifu.Visible = false; ltxt_weipay.ReadOnly = true; dataGridViewFujia.ReadOnly = true; dataGridViewFujia.AllowUserToResizeColumns = false; //是否可以调整列的大小 dataGridViewFujia.AllowUserToResizeRows = false; //是否可以调整行的大小 txt_caigoucode.Text = _buycode; ltxt_suname.Text = _suname; ltxt_AccountName.Text = _acountname; txt_shif.Text = _fukuan; ltxt_saleman.Text = _saleman; } catch (Exception ex) { MessageBox.Show("错误代码:3205-创建采购付款单异常,异常信息:" + ex.Message); } textBoxOddNumbers.Text = BuildCode.ModuleCode("AP"); }
private void buttonSave_Click(object sender, EventArgs e) { RoleManager rm = new RoleManager(); PermissionManager pm = new PermissionManager(); Role role = new Role(); string percode = BuildCode.ModuleCode("PE"); string rolecode = BuildCode.ModuleCode("RO"); // 新增一个角色信息 role.Role_Code = rolecode; role.Role_Modules = ""; role.Role_Name = textBoxName.Text.Trim(); int roleAddResult = 0; try { roleAddResult = rm.Add(role); } catch (Exception ex) { MessageBox.Show("增加角色失败,请检查服务器连接.错误信息:" + ex.Message); } if (roleAddResult == 0) { MessageBox.Show("未能成功新增角色数据,请重试"); return; } try { List <Permission> permList = new List <Permission>(); string[] nameList = { "用户资料", "权限分配", "仓库资料", "货品资料", "供应商资料", "物料信息", "仓库系统", "销售系统", "售后系统", "采购系统", "财务系统", "考勤系统" }; //填充权限实体列表 initPermission(permList, rolecode, nameList); int result = pm.AddBatch(permList); if (result > 0) { MessageBox.Show("新增用户角色成功,该角色所有模块默认不可读写."); } //触发事件新增节点 refresh?.Invoke(textBoxName.Text, rolecode); } catch (Exception ex) { rm.Delete(roleAddResult); MessageBox.Show("分配角色权限,请检查服务器连接.错误信息:" + ex.Message); } }
private void BuyInForm_Load(object sender, EventArgs e) { MaterialManager mm = new MaterialManager(); StorageManager sm = new StorageManager(); SupplierManager sum = new SupplierManager(); _AllMaterial = mm.GetList(""); _AllStorage = sm.GetList(""); _AllSupplier = sum.SelSupplierTable(); if (AuditStatus == 0) { buttonExamine.Visible = true; } //禁用自动创建列 dataGridView1.AutoGenerateColumns = false; dataGridViewFujia.AutoGenerateColumns = false; //初始化商品下拉列表 InitMaterialDataGridView(); //初始化datagridview InitDataGridView(); dataGridView1.DataSource = _AllMaterial.Tables[0]; //绑定事件 双击事填充内容并隐藏列表 dataGridView1.CellDoubleClick += DataGridView1_CellDoubleClick; dataGridViewFujia.CellDoubleClick += DataGridViewFujia_CellDoubleClick; //采购单单号 BuyOdd = BuildCode.ModuleCode("BA"); textBoxOddNumbers.Text = BuyOdd; labtextboxTop3.Text = "0"; textBoxX3.Text = "0"; textBoxX2.Text = "0"; labtextboxTop5.Text = "0"; InitSupplier(); //使控件只能输入正确的数字和小数点 textBoxX2.CommandKeyDown += textBox_CommandKeyDown; textBoxX3.CommandKeyDown += textBox_CommandKeyDown; labtextboxTop3.CommandKeyDown += textBox_CommandKeyDown; labtextboxTop4.CommandKeyDown += textBox_CommandKeyDown; labtextboxTop5.CommandKeyDown += textBox_CommandKeyDown; //labtextboxTop3.Text = (Convert.ToDecimal(textBoxX3.Text) * // (Convert.ToDecimal(textBoxX2.Text) / 100)).ToString(); labtextboxTop5.Text = (Convert.ToDecimal(textBoxX3.Text) - Convert.ToDecimal(labtextboxTop3.Text)).ToString(); }
private void button1_Click(object sender, EventArgs e) { EmpolyeeForm empM = (EmpolyeeForm)Owner; if (InsTextIsNull() == false) { return; } try { int result = InsEmpolyeeFun(empM.StateType); if (result > 0) { empM.isflag = true; if (checkBoxLogin.Checked) { //保存user表 User u = new User(); u.User_CardCode = ""; u.User_code = BuildCode.ModuleCode("US"); u.User_Manager = 0; u.User_Name = textBox1.Text.Trim(); u.User_Password = "******"; u.User_Role = cbe_juese.SelectedValue.ToString(); u.User_zhiwen = ""; int uresult = um.Add(u); if (uresult < 1) { MessageBox.Show("在给该成员分配登录权限时失败,请尝试使用新增登录用户功能添加"); } } MessageBox.Show("保存成功"); Close(); Dispose(); } else { empM.isflag = false; MessageBox.Show("保存失败"); } } catch (Exception ex) { MessageBox.Show("保存数据失败,请检查服务器连接并尝试重新保存.错误:" + ex.Message); } }
/// <summary> /// 根据文本框内容建立实体数据 /// </summary> /// <returns></returns> private Storage fillStorage() { Storage storage = new Storage(); storage.St_Address = textBoxXAddress.Text; storage.St_Clear = 1; storage.St_Code = BuildCode.ModuleCode("ST"); storage.St_EmpName = textBoxXMan.Text.Trim(); storage.St_Enable = checkBoxXEnable.Checked ? 0 : 1; storage.St_Name = textBoxXName.Text.Trim(); storage.St_Phone = textBoxXPhone.Text.Trim(); storage.St_Remark = textBoxXRemark.Text; storage.St_Safetyone = ""; storage.St_Safetytwo = ""; return(storage); }
//保存并退出按钮 private void buttonX3_Click(object sender, EventArgs e) { Model.Department dep = new Model.Department(); try { if (_update == false) { dep.Dt_Name = XYEEncoding.strCodeHex(this.textBoxXName.Text.Trim()); dep.Dt_RoleCode = comboBoxEx1.SelectedValue == null ? "" : XYEEncoding.strCodeHex(comboBoxEx1.SelectedValue.ToString()); dep.Dt_Code = XYEEncoding.strCodeHex(BuildCode.ModuleCode("DT")); dep.Dt_Clear = 1; int result = depm.InsDepartment(dep); if (result == 1) { MessageBox.Show("部门添加成功!"); this.Close(); this.Dispose(); } else { MessageBox.Show("部门保存失败!"); } } else { dep.Dt_Name = this.textBoxXName.Text.Trim(); dep.Dt_RoleCode = comboBoxEx1.SelectedValue == null ? "" : comboBoxEx1.SelectedValue.ToString(); dep.Dt_Code = _Department.Dt_Code; int r = depm.UpdateDepartment(dep); if (r == 1) { MessageBox.Show("修改部门成功!"); this.Close(); this.Dispose(); } else { MessageBox.Show("修改部门失败!"); } } } catch (Exception ex) { MessageBox.Show("错误,添加或者修改错误" + ex.Message); } }
private void StockIn_Load(object sender, EventArgs e) { StorageManager sm = new StorageManager(); //仓库 SupplierManager supply = new SupplierManager(); //供应商 _AllStorage = sm.GetList(""); _AllSupply = supply.SelSupplierTable(); //禁用自动创建列 dataGridView1.AutoGenerateColumns = false; dataGridViewFujia.AutoGenerateColumns = false; //入库单单号 textBoxOddNumbers.Text = BuildCode.ModuleCode("OI"); //绑定事件 双击事填充内容并隐藏列表 dataGridViewFujia.CellDoubleClick += DataGridViewFujia_CellDoubleClick; // 将dataGridView中的内容居中显示 dataGridViewFujia.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
/// <summary> /// 加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InsSupplier_Load(object sender, EventArgs e) { AddTree("", null, "", comboTree1); comboTree1.AdvTree.NodeDoubleClick += AdvTree_NodeDoubleClick; SupplierForm supplierMaterial = (SupplierForm)this.Owner; switch (supplierMaterial.stats) { case 0: su_code.Text = BuildCode.ModuleCode("Su"); break; case 1: BindControl(); break; default: MessageBox.Show("类型错误!"); break; } //if (supplierMaterial.stats == 0) //{ // su_code.Text = BuildCode.ModuleCode("Supplier"); // // int result = InsSupplierFun(); // // if (result > 0) // // { // // MessageBox.Show(string.Format("编号:{0},新增成功", su_code.ToString())); // // supplierMaterial.isflag = true; // // } // // else // // { // // MessageBox.Show("未知错误,添加失败"); // // supplierMaterial.isflag = false; // // } //} //if (supplierMaterial.stats == 1) //{ // BindControl(); //} }
private void InsBankAccount_Load(object sender, EventArgs e) { BankAccountForm bam = (BankAccountForm)Owner; try { switch (bam.StateType) { case 0: textBox1.Text = BuildCode.ModuleCode("BA"); break; case 1: BankAccount tba = bm.SelBankAccountByCode(bam.id); textBox1.Text = XYEEncoding.strHexDecode(tba.Ba_Code); textBox3.Text = XYEEncoding.strHexDecode(tba.Ba_CardHolder); textBox2.Text = XYEEncoding.strHexDecode(tba.Ba_Account); textBox4.Text = XYEEncoding.strHexDecode(tba.Ba_OpenBank); textBox5.Text = XYEEncoding.strHexDecode(tba.Ba_AvailablePrice); textBox6.Text = XYEEncoding.strHexDecode(tba.Ba_Remark); if (tba.Ba_Enable == 1) { radioButton2.Checked = true; } else { radioButton1.Checked = true; } break; default: MessageBox.Show("类型错误!"); break; } } catch (Exception ex) { MessageBox.Show("加载数据失败,请检查服务器连接并尝试刷新.错误:" + ex.Message); } }
private void StockOut_Load(object sender, EventArgs e) { #region 隐藏控件 checkBox1.Visible = false; labTop4.Visible = false; labTop5.Visible = false; labTop6.Visible = false; labTop7.Visible = false; labTop8.Visible = false; labTop9.Visible = false; labtextboxTop4.Visible = false; labtextboxTop5.Visible = false; labtextboxTop6.Visible = false; labtextboxTop7.Visible = false; labtextboxTop8.Visible = false; labtextboxTop9.Visible = false; pictureBox3.Visible = false; pictureBox4.Visible = false; #endregion StorageManager sm = new StorageManager(); //仓库 ClientManager cm = new ClientManager(); //客户 _AllStorage = sm.GetList(""); _AllClient = cm.GetList(""); //禁用自动创建列 dataGridView1.AutoGenerateColumns = false; dataGridViewFujia.AutoGenerateColumns = false; //出库单单号 textBoxOddNumbers.Text = BuildCode.ModuleCode("OO"); //绑定事件 双击事填充内容并隐藏列表 dataGridViewFujia.CellDoubleClick += DataGridViewFujia_CellDoubleClick; // 将dataGridView中的内容居中显示 dataGridViewFujia.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
private void InsSellGathering_Load(object sender, EventArgs e) { #region 初始化列 GridColumn gc = null; gc = new GridColumn(); gc.DataPropertyName = "Sell_Code"; gc.Name = "Code"; gc.HeaderText = "销售单号"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_StockName"; gc.Name = "StockName"; gc.HeaderText = "仓库名称"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_MaID"; gc.Name = "MaID"; gc.HeaderText = "编码"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_MaName"; gc.Name = "MaName"; gc.HeaderText = "商品名称"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Model"; gc.Name = "Model"; gc.HeaderText = "规格型号"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Unit"; gc.Name = "Unit"; gc.HeaderText = "单位"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_DiscountBPrice"; gc.Name = "DiscountBPrice"; gc.HeaderText = "单价"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_CurNumber"; gc.Name = "CurNumber"; gc.HeaderText = "需求数量"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_ReNumber"; gc.Name = "ReNumber"; gc.HeaderText = "实发数量"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_LostNumber"; gc.Name = "LostNumber"; gc.HeaderText = "缺少数量"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Discount"; gc.Name = "Discount"; gc.HeaderText = "折扣率"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_DiscountBPrice"; gc.Name = "DiscountBPrice"; gc.HeaderText = "折后金额"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Money"; gc.Name = "Money"; gc.HeaderText = "总金额"; superGridControl1.PrimaryGrid.Columns.Add(gc); gc = new GridColumn(); gc.DataPropertyName = "Sell_Remark"; gc.Name = "Remark"; gc.HeaderText = "备注"; superGridControl1.PrimaryGrid.Columns.Add(gc); superGridControl1.PrimaryGrid.DataSource = sdm.GetList(string.Format("Sell_Code='{0}'", XYEEncoding.strCodeHex(Sell_Code))); #endregion //ltxt_salecode.Text = Sell_Code; ; //ltxt_kehu.Text = C_ClientName; //ltxt_AccountName.Text = C_AccountName; //ltxt_yingshou.Text = C_AmountPay; ltxt_shishou.Text = "0"; ltxt_weishou.Text = "0"; ltxt_shoukuan.Text = "0"; ltxt_yingshou.Text = "0"; // ltxt_salecode.Text = _sellcode; Model.Sell sell = sm.SelSellGatheringBySellCode(ltxt_salecode.Text.Trim()); ltxt_salecode.Text = _sellcode; ltxt_kehu.Text = _Sell_ClientName; ltxt_yingshou.Text = Convert.ToDecimal(_OddMoney).ToString("0.00"); ltxt_shoukuan.Text = Convert.ToDecimal(_InMoney).ToString("0.00"); ltxt_weishou.Text = Convert.ToDecimal(_LastMoney).ToString("0.00"); ltxt_method.Text = _fukuanfangshi; ltxt_saleman.Text = _Salesman; ltxt_remark.Text = _Remark; //if (sell != null) //{ // ltxt_salecode.Text = _sellcode; // ltxt_kehu.Text = sell.Sell_ClientName; // ltxt_AccountName.Text = sell.Sell_AccountCode; // ltxt_yingshou.ReadOnly = true; // ltxt_yingshou.Text = Convert.ToDecimal(sell.Sell_OddMoney).ToString("0.00"); // ltxt_shoukuan.Text = Convert.ToDecimal(sell.Sell_InMoney).ToString("0.00"); // ltxt_weishou.Text = Convert.ToDecimal(sell.Sell_LastMoney).ToString("0.00"); // ltxt_method.Text = sell.Sell_fukuanfangshi; // ltxt_saleman.Text = sell.Sell_Salesman; // ltxt_operation.Text = sell.Sell_Operation; // ltxt_remark.Text = sell.Sell_Remark; // ltxt_weishou.Text = sell.Sell_OddMoney; //} if (string.IsNullOrWhiteSpace(textBoxOddNumbers.Text)) { textBoxOddNumbers.Text = BuildCode.ModuleCode("AC"); conll.C_No = textBoxOddNumbers.Text;//资金收款编号 } //ltxt_salecode.Text //textBoxX1.Text = "0"; //制单人 LoginInfomation l = LoginInfomation.getInstance(); l.UserName = "******"; ltxt_operation.Text = l.UserName; dataGridViewFujia.ReadOnly = true; dataGridViewFujia.AllowUserToResizeColumns = false; //是否可以调整列的大小 dataGridViewFujia.AllowUserToResizeRows = false; //是否可以调整行的大小 }
protected override void form_save_Click(object sender, EventArgs e) { if (InsTextIsNull() == false) { return; } ProjectCost pic = null; ProjectCostType pict = (ProjectCostType)Owner; int result = 0; switch (state) { case 0: pic = new ProjectCost() { PC_Name = textBox1.Text.Trim(), PC_Clear = 1, PC_Enable = 1, PC_Code = BuildCode.ModuleCode("PCN"), PC_ParentId = code }; try { result = micm.InsProjectCost(pic); if (result > 0) { MessageBox.Show("保存成功!"); pict.isflag = true; Close(); Dispose(); return; } else { MessageBox.Show("保存失败!"); pict.isflag = false; return; } } catch (Exception ex) { MessageBox.Show("保存失败,请检查服务器连接并尝试重新保存.错误:" + ex.Message); } break; case 1: pic = new ProjectCost() { PC_Name = textBox1.Text.Trim(), PC_Clear = 1, PC_Enable = 1, PC_Code = BuildCode.ModuleCode("PCN"), PC_ParentId = code }; try { result = micm.InsProjectCost(pic); if (result > 0) { MessageBox.Show("保存成功!"); pict.isflag = true; Close(); Dispose(); return; } else { MessageBox.Show("保存失败!"); pict.isflag = false; return; } } catch (Exception ex) { MessageBox.Show("保存失败,请检查服务器连接并尝试重新保存.错误:" + ex.Message); } break; case 2: try { result = micm.UpdateNameProjectCost(textBox1.Text, code, txtName); if (result > 0) { MessageBox.Show("保存成功!"); pict.isflag = true; Close(); Dispose(); return; } else { MessageBox.Show("保存失败!"); pict.isflag = false; return; } } catch (Exception ex) { MessageBox.Show("保存失败,请检查服务器连接并尝试重新保存.错误:" + ex.Message); } break; default: MessageBox.Show("选择错误!"); break; } }
private void form_save_Click(object sender, EventArgs e) { if (city == null) { ClientForm clientForm = (ClientForm)this.Owner; City city = new City() { City_Name = XYEEncoding.strCodeHex(textBox1.Text.Trim()), City_ParentId = XYEEncoding.strCodeHex(city_code), City_Clear = 1, City_Enable = 1, City_Code = XYEEncoding.strCodeHex(BuildCode.ModuleCode("City")) }; try { int result = cm.Add(city); if (result > 0) { clientForm.Isflag = true; MessageBox.Show("地区名称:" + textBox1.Text + " \n添加成功"); Close(); } else { clientForm.Isflag = false; MessageBox.Show("添加失败,请重新添加"); Close(); } } catch (Exception ex) { MessageBox.Show("新增地区资料错误,请检查服务器连接.错误信息:" + ex.Message); } } else { city.City_Name = textBox1.Text.Trim(); try { bool result = cm.UpdateByCode(city); if (result) { ClientForm clientForm = (ClientForm)this.Owner; clientForm.Isflag = true; MessageBox.Show("地区名称:" + textBox1.Text + " \n修改成功"); Close(); } else { ClientForm clientForm = (ClientForm)this.Owner; clientForm.Isflag = false; MessageBox.Show("修改失败,请重新修改"); Close(); } } catch (Exception ex) { MessageBox.Show("新增地区资料错误,请检查服务器连接.错误信息:" + ex.Message); } } }
//新增客户时把对应的客户折扣新增 private void buttonXEnter_Click(object sender, EventArgs e) { //等于null为新增,不等于为更新 if (client != null) { if (string.IsNullOrWhiteSpace(textBoxXName.Text) && string.IsNullOrWhiteSpace(textBoxXCompany.Text)) { MessageBox.Show("单位名称和客户名不可为空"); return; } Client newClient = new Client(); ClientManager cm = new ClientManager(); newClient.Cli_Code = XYEEncoding.strCodeHex(client.Cli_Code); newClient.Cli_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); newClient.Cli_Phone = XYEEncoding.strCodeHex(textBoxXPhone.Text.Trim()); newClient.Cli_PhoneTwo = XYEEncoding.strCodeHex(textBoxXPhone2.Text.Trim()); newClient.Cli_LinkMan = XYEEncoding.strCodeHex(textBoxXMan.Text.Trim()); newClient.Cli_faxes = XYEEncoding.strCodeHex(textBoxXFax.Text.Trim()); newClient.Cli_Address = XYEEncoding.strCodeHex(textBoxXAddress.Text.Trim()); newClient.Cli_Company = XYEEncoding.strCodeHex(textBoxXCompany.Text); newClient.Cli_Citycode = XYEEncoding.strCodeHex(comboTreeCity.SelectedNode == null ? "" : comboTreeCity.SelectedNode.Tag.ToString()); newClient.Cli_area = XYEEncoding.strCodeHex(comboTreeCity.SelectedNode == null ? "" : comboTreeCity.SelectedNode.FullPath.Replace(";", "/")); newClient.Cli_TypeCode = XYEEncoding.strCodeHex(comboTreeType.SelectedNode == null ? "" : comboTreeType.SelectedNode.Tag.ToString()); newClient.Cli_typename = XYEEncoding.strCodeHex(comboTreeType.SelectedNode == null ? "" : comboTreeType.SelectedNode.FullPath.Replace(";", "/")); newClient.Cli_Bankaccounts = XYEEncoding.strCodeHex(textBoxXBankCode.Text.Trim()); newClient.Cli_OpenBank = XYEEncoding.strCodeHex(textBoxXBank.Text.Trim()); newClient.Cli_Limit = XYEEncoding.strCodeHex(textBoxXAmout.Text.Trim()); newClient.Cli_ClearLimitdate = XYEEncoding.strCodeHex(integerInputDay.Value.ToString()); newClient.Cli_Remark = XYEEncoding.strCodeHex(textBoxXRemark.Text); newClient.Cli_zhiwen = client.Cli_zhiwen; newClient.Cli_PicName = client.Cli_PicName; newClient.Cli_DiscountCode = XYEEncoding.strCodeHex(client.Cli_DiscountCode); newClient.Cli_Olddata = null; newClient.Cli_Oldreturn = null; newClient.Cli_Newoutdata = null; newClient.Cli_Newintodata = null; newClient.Cli_Createdata = client.Cli_Createdata; newClient.Cli_RemainLimit = XYEEncoding.strCodeHex(newClient.Cli_Limit); newClient.Cli_ShouldMoney = XYEEncoding.strCodeHex(client.Cli_ShouldMoney); newClient.Cli_GetMoney = XYEEncoding.strCodeHex(client.Cli_GetMoney); newClient.Cli_PreMoney = XYEEncoding.strCodeHex(client.Cli_PreMoney); newClient.Cli_safetone = client.Cli_safetone; newClient.Cli_safettwo = client.Cli_safettwo; newClient.Cli_Enable = 1; newClient.Cli_ID = client.Cli_ID; try { bool result = cm.UpdateByCode(newClient); if (result) { MessageBox.Show("更新成功,数据已更改!"); ClientForm cf = (ClientForm)this.Owner; cf.Isflag = true; } else { MessageBox.Show("更新失败,请检查服务器连接并尝试重新更新数据"); } Close(); } catch (Exception ex) { MessageBox.Show("异常:" + ex.Message); Close(); } } else { if (textBoxXCompany.Text.Trim() == "" || textBoxXName.Text.Trim() == "") { MessageBox.Show("单位名称和客户名不可为空"); } else { if (checkBoxXDis.Checked && string.IsNullOrWhiteSpace(textBoxXDeadline.Text)) { MessageBox.Show("若折扣有期限则需输入期限长度,若无期限请取消勾选"); return; } Discount d = new Discount(); string clcode = XYEEncoding.strCodeHex(BuildCode.ModuleCode("CL")); string dicode = XYEEncoding.strCodeHex(BuildCode.ModuleCode("DI")); d.Dis_Code = dicode; d.Dis_ClientCode = clcode; d.Dis_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); d.Dis_CreateDate = DateTime.Now; if (checkBoxXDis.Checked) { int number = Convert.ToInt32(textBoxXDeadline.Text.Trim()); DateTime tempD = DateTime.Now; switch (comboBoxExDeadline.Text) { case "年": tempD.AddYears(number); break; case "月": tempD.AddMonths(number); break; case "日": tempD.AddDays(number); break; } d.Dis_ClearDate = tempD; } else { d.Dis_ClearDate = null; } d.Dis_Enable = 1; d.Dis_Remark = ""; d.Dis_Clear = 1; d.Dis_Discount = XYEEncoding.strCodeHex(textBoxXDisc.Text.Trim()); ClientManager cm = new ClientManager(); Client c = new Client(); c.Cli_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); c.Cli_Code = clcode; c.Cli_Phone = XYEEncoding.strCodeHex(textBoxXPhone.Text.Trim()); c.Cli_PhoneTwo = XYEEncoding.strCodeHex(textBoxXPhone2.Text.Trim()); c.Cli_LinkMan = XYEEncoding.strCodeHex(textBoxXMan.Text.Trim()); c.Cli_faxes = XYEEncoding.strCodeHex(textBoxXFax.Text.Trim()); c.Cli_Address = XYEEncoding.strCodeHex(textBoxXAddress.Text.Trim()); c.Cli_Citycode = XYEEncoding.strCodeHex(comboTreeCity.SelectedNode == null ? "" : comboTreeCity.SelectedNode.Tag.ToString()); c.Cli_area = XYEEncoding.strCodeHex(comboTreeCity.SelectedNode == null ? "" : comboTreeCity.SelectedNode.FullPath.Replace(";", "/")); c.Cli_Company = XYEEncoding.strCodeHex(textBoxXCompany.Text); c.Cli_TypeCode = XYEEncoding.strCodeHex(comboTreeType.SelectedNode == null ? "" : comboTreeType.SelectedNode.Tag.ToString()); c.Cli_typename = XYEEncoding.strCodeHex(comboTreeType.SelectedNode == null ? "" : comboTreeType.SelectedNode.FullPath.Replace(";", "/")); c.Cli_DiscountCode = XYEEncoding.strCodeHex(clcode); c.Cli_Bankaccounts = XYEEncoding.strCodeHex(textBoxXBankCode.Text.Trim()); c.Cli_OpenBank = XYEEncoding.strCodeHex(textBoxXBank.Text.Trim()); c.Cli_Createdata = DateTime.Now; c.Cli_Limit = XYEEncoding.strCodeHex(textBoxXAmout.Text.Trim()); c.Cli_RemainLimit = c.Cli_Limit; c.Cli_ClearLimitdate = XYEEncoding.strCodeHex(integerInputDay.Value.ToString()); c.Cli_ShouldMoney = XYEEncoding.strCodeHex("0"); c.Cli_GetMoney = XYEEncoding.strCodeHex(textBoxXAmout.Text.Trim()); c.Cli_PreMoney = XYEEncoding.strCodeHex(textBoxXAmout.Text.Trim()); c.Cli_Remark = XYEEncoding.strCodeHex(textBoxXRemark.Text); c.Cli_Enable = 1; try { bool result = cm.AddClientAndDiscount(c, d); if (result) { MessageBox.Show("添加客户成功"); ClientForm cf = (ClientForm)this.Owner; cf.Isflag = true; Close(); } else { MessageBox.Show("添加客户失败,请检查服务器连接并重新添加"); Close(); } } catch (Exception ex) { MessageBox.Show("更新失败,请检查错误:" + ex.Message); Close(); } } } }
private void buttonXEnter_Click(object sender, EventArgs e) { if (material == null) { if (!string.IsNullOrWhiteSpace(textBoxXName.Text)) { Model.Material material = new Model.Material(); material.Ma_Barcode = XYEEncoding.strCodeHex(textBoxXBarcode.Text.Trim()); material.Ma_Clear = 1; material.Ma_Code = XYEEncoding.strCodeHex(BuildCode.ModuleCode("MA")); if (dateTimeInputCreate.Text != "") { material.Ma_CreateDate = dateTimeInputCreate.Value.Date; } material.Ma_Enable = checkBoxXEnable.Checked ? 0 : 1; if (dateTimeInputInput.Text != "") { material.Ma_InDate = dateTimeInputInput.Value.Date; } material.Ma_InPrice = XYEEncoding.strCodeHex(textBoxXInPrice.Text.Trim()); material.Ma_Model = XYEEncoding.strCodeHex(textBoxXTypeModel.Text.Trim()); material.Ma_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); material.Ma_PicName = ""; material.Ma_Price = XYEEncoding.strCodeHex(textBoxXOutPrice.Text.Trim()); material.Ma_PriceA = XYEEncoding.strCodeHex(textBoxXPA.Text.Trim()); material.Ma_PriceB = XYEEncoding.strCodeHex(textBoxXPB.Text.Trim()); material.Ma_PriceC = XYEEncoding.strCodeHex(textBoxXPC.Text.Trim()); material.Ma_PriceD = XYEEncoding.strCodeHex(textBoxXPD.Text.Trim()); material.Ma_PriceE = ""; material.Ma_Remark = XYEEncoding.strCodeHex(textBoxXRemark.Text.Trim()); material.Ma_RFID = XYEEncoding.strCodeHex(textBoxXRFID.Text.Trim()); if (comboBoxExSupplier.SelectedText != null && comboBoxExSupplier.SelectedValue != null) { material.Ma_SupID = XYEEncoding.strCodeHex(comboBoxExSupplier.SelectedValue.ToString()); material.Ma_Supplier = XYEEncoding.strCodeHex(comboBoxExSupplier.SelectedText); } if (comboTreeType.SelectedNode != null) { material.Ma_TypeID = XYEEncoding.strCodeHex(comboTreeType.SelectedNode.Tag.ToString()); material.Ma_TypeName = XYEEncoding.strCodeHex(comboTreeType.SelectedNode.FullPath.Replace(';', '/')); } material.Ma_Unit = XYEEncoding.strCodeHex(textBoxXUnit.Text.Trim()); material.Ma_zhujima = XYEEncoding.strCodeHex(textBoxXzhujima.Text.Trim()); MaterialManager mm = new MaterialManager(); try { int result = mm.Add(material); if (result > 0) { MessageBox.Show("新增产品成功!"); MaterialForm mf = (MaterialForm)this.Owner; mf.Isflag = true; } else { MessageBox.Show("更新失败,请检查服务器连接并尝试重新更新数据"); } Close(); } catch (Exception ex) { MessageBox.Show("新增产品出错,请检查服务器连接.错误:" + ex.Message); Close(); } } else { MessageBox.Show("货品名称不可为空,请注意 电影时间确实太短了,要把故事说全的话估计"); } } else { if (!string.IsNullOrWhiteSpace(textBoxXName.Text)) { material.Ma_Barcode = XYEEncoding.strCodeHex(textBoxXBarcode.Text.Trim()); if (dateTimeInputCreate.Text != "") { material.Ma_CreateDate = dateTimeInputCreate.Value; } if (dateTimeInputInput.Text != "") { material.Ma_InDate = dateTimeInputInput.Value; } material.Ma_InPrice = XYEEncoding.strCodeHex(textBoxXInPrice.Text.Trim()); material.Ma_Model = XYEEncoding.strCodeHex(textBoxXTypeModel.Text.Trim()); material.Ma_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); material.Ma_Price = XYEEncoding.strCodeHex(textBoxXOutPrice.Text.Trim()); material.Ma_PriceA = XYEEncoding.strCodeHex(textBoxXPA.Text.Trim()); material.Ma_PriceB = XYEEncoding.strCodeHex(textBoxXPB.Text.Trim()); material.Ma_PriceC = XYEEncoding.strCodeHex(textBoxXPC.Text.Trim()); material.Ma_PriceD = XYEEncoding.strCodeHex(textBoxXPD.Text.Trim()); material.Ma_PriceE = ""; material.Ma_Remark = XYEEncoding.strCodeHex(textBoxXRemark.Text.Trim()); material.Ma_RFID = XYEEncoding.strCodeHex(textBoxXRFID.Text.Trim()); if (comboBoxExSupplier.SelectedText != null && comboBoxExSupplier.SelectedValue != null) { material.Ma_SupID = XYEEncoding.strCodeHex(comboBoxExSupplier.SelectedValue.ToString()); material.Ma_Supplier = XYEEncoding.strCodeHex(comboBoxExSupplier.SelectedText); } if (comboTreeType.SelectedNode != null) { material.Ma_TypeID = XYEEncoding.strCodeHex(comboTreeType.SelectedNode.Tag.ToString()); material.Ma_TypeName = XYEEncoding.strCodeHex(comboTreeType.SelectedNode.FullPath.Replace(';', '/')); } material.Ma_Unit = XYEEncoding.strCodeHex(textBoxXUnit.Text.Trim()); material.Ma_zhujima = XYEEncoding.strCodeHex(textBoxXzhujima.Text.Trim()); MaterialManager mm = new MaterialManager(); try { bool result = mm.Update(material); if (result) { MessageBox.Show("更新产品信息成功!"); MaterialForm mf = (MaterialForm)this.Owner; mf.Isflag = true; } else { MessageBox.Show("更新失败,请检查服务器连接并尝试重新更新数据"); } Close(); } catch (Exception ex) { MessageBox.Show("更新产品出错,请检查服务器连接.错误:" + ex.Message); Close(); } } else { MessageBox.Show("货品名称不可为空,请注意"); } } }
private void InsEmpolyee_Load(object sender, EventArgs e) { textBox2.Enabled = false; comboBox1.SelectedIndex = 0; textBox11.Text = DateTime.Now.ToString(); comboBox1.DataSource = dm.SelDepartment(); comboBox1.DisplayMember = "Dt_Name"; comboBox1.ValueMember = "Dt_Code"; //绑定角色下拉框 DataTable dt = role.GetAllList().Tables[0]; cbe_juese.DataSource = dt; cbe_juese.DisplayMember = "Role_Name"; cbe_juese.ValueMember = "Role_Code"; cbe_juese.SelectedIndex = 0; EmpolyeeForm empM = (EmpolyeeForm)Owner; try { switch (empM.StateType) { case 0: textBox2.Text = BuildCode.ModuleCode("EMP"); break; case 1: Model.Empolyee empolyee = em.SelEmpolyeeByCode(empM.id); textBox1.Text = empolyee.Emp_Name; textBox2.Text = empolyee.Emp_Code; //获取选中的地址,绑定在地址的三个控件上面 string str = empolyee.Emp_Area; string[] sArray = str.Split(new char[] { '/' }); tb_sheng.Text = sArray[0].ToString(); tb_shi.Text = sArray[1].ToString(); tb_qu.Text = sArray[2].ToString(); // tb_pws.Text = empolyee.Emp_Password; textBox3.Text = empolyee.Emp_CardCode; textBox4.Text = empolyee.Emp_Phone; textBox5.Text = empolyee.Emp_Card; textBox6.Text = empolyee.Emp_Birthday.ToString(); textBox7.Text = empolyee.Emp_Email; textBox8.Text = empolyee.Emp_School; textBox9.Text = empolyee.Emp_Bank; textBox10.Text = empolyee.Emp_OpenBank; textBox11.Text = empolyee.Emp_Entry.ToString(); comboBox1.Text = XYEEncoding.strHexDecode(dm.SelDepartmentByCode(XYEEncoding.strCodeHex(empolyee.Emp_Depid)).Dt_Name); // cbe_juese.Text = XYEEncoding.strHexDecode(role.GetModel(XYEEncoding.strCodeHex(empolyee.Emp_UserRole)).Role_Name); // comboBox2.Text = empolyee.Emp_Education; if (empolyee.Emp_Sex == "男") { radioButton1.Checked = true; } else { radioButton2.Checked = true; } if (empolyee.Emp_State == 0) { checkBox2.Checked = true; } if (empolyee.Emp_Enable == 0) { checkBox1.Checked = true; } break; default: MessageBox.Show("类型错误!"); break; } } catch (Exception ex) { MessageBox.Show("加载数据失败,请检查服务器连接并尝试刷新.错误:" + ex.Message); } }
private void buttonXSave_Click(object sender, EventArgs e) { string userName = textBoxXName.Text; string password = textBoxXPassword.Text; string userRole = comboboxXRole.Text; //检查是否为空 if (string.IsNullOrWhiteSpace(userName)) { labelXNameWarning.Visible = true; return; } if (string.IsNullOrWhiteSpace(password)) { labelXPwWarning.Visible = true; return; } if (string.IsNullOrWhiteSpace(labelXPwAWarning.Text)) { labelXPwAWarning.Visible = true; return; } if (string.IsNullOrWhiteSpace(userRole)) { labelXRoleWarning.Visible = true; return; } labelXNameWarning.Visible = false; labelXPwWarning.Visible = false; labelXPwAWarning.Visible = false; labelXRoleWarning.Visible = false; //实体赋值,创建用户 User u = new User(); u.User_code = BuildCode.ModuleCode("US"); u.User_CardCode = ""; u.User_Manager = 0; u.User_Name = userName; u.User_Password = password; u.User_Role = userRole; u.User_zhiwen = ""; UserManager um = new UserManager(); try { int result = um.Add(u); if (result > 0) { MessageBox.Show("增加用户 " + userName + " 成功"); textBoxXName.Text = ""; textBoxXPassword.Text = ""; textBoxXPasswordAgain.Text = ""; comboboxXRole.SelectedIndex = -1; } } catch (Exception ex) { MessageBox.Show("新增管理员异常,请检查服务器连接.异常:" + ex.Message); } }
private void form_save_Click_1(object sender, EventArgs e) { if (InsTextIsNull() == false) { return; } City city = null; CityType ct = (CityType)Owner; try { switch (state) { case 0: city = new City() { City_Name = textBox1.Text.Trim(), City_Clear = 1, City_Enable = 1, City_Code = BuildCode.ModuleCode("CN"), City_ParentId = code }; int result = cm.InsCity(city); if (result > 0) { MessageBox.Show("保存成功!"); ct.isflag = true; Close(); Dispose(); return; } else { MessageBox.Show("保存失败!"); ct.isflag = false; return; } case 1: city = new City() { City_Name = textBox1.Text.Trim(), City_Clear = 1, City_Enable = 1, City_Code = BuildCode.ModuleCode("CN"), City_ParentId = code }; result = cm.InsCity(city); if (result > 0) { MessageBox.Show("保存成功!"); ct.isflag = true; Close(); Dispose(); return; } else { MessageBox.Show("保存失败"); ct.isflag = false; return; } case 2: result = cm.UpdateNameCity(textBox1.Text, code, txtName); if (result > 0) { MessageBox.Show("保存成功!"); ct.isflag = true; Close(); Dispose(); return; } else { MessageBox.Show("保存失败!"); ct.isflag = false; return; } default: MessageBox.Show("选择错误!"); break; } } catch (Exception ex) { MessageBox.Show("保存失败,请检查服务器连接并尝试保存.错误:" + ex.Message); } }
private void buttonXOK_Click(object sender, EventArgs e) { ClientType ct = new ClientType(); ClientTypeManager ctm = new ClientTypeManager(); ClientTypeForm ctf = (ClientTypeForm)this.Owner; switch (formStatic) { case "增": ct.CT_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); ct.CT_Remark = XYEEncoding.strCodeHex(richTextBoxExRe.Text); ct.CT_Code = XYEEncoding.strCodeHex(BuildCode.ModuleCode("CL")); ct.CT_Enable = 1; int insertResult = 0; try { insertResult = ctm.Add(ct); } catch (Exception ex) { MessageBox.Show("系统异常:" + ex.Message); exceptionFlag = false; } if (insertResult > 0 && exceptionFlag) { ctf.loadData(); MessageBox.Show("添加成功!"); } else { MessageBox.Show("添加失败,请尝试重新添加"); } break; case "改": ct.CT_Name = XYEEncoding.strCodeHex(textBoxXName.Text.Trim()); ct.CT_Remark = XYEEncoding.strCodeHex(richTextBoxExRe.Text); ct.CT_Enable = 1; bool updateResult = false; try { updateResult = ctm.Update(ct); } catch (Exception ex) { MessageBox.Show("系统异常:" + ex.Message); exceptionFlag = false; } if (updateResult && exceptionFlag) { ctf.loadData(); MessageBox.Show("更新成功!"); } else { MessageBox.Show("更新失败,请尝试重新添加"); } break; case "": MessageBox.Show("初始化异常,请重新操作"); break; } if (!exceptionFlag) { this.Close(); } }
private void form_save_Click(object sender, EventArgs e) { if (_MaterialType == null) { MaterialType materialType = new MaterialType() { MT_Name = textBox1.Text.Trim(), MT_ParentID = _MType_Code, MT_Clear = 1, MT_Enable = 1, MT_Code = BuildCode.ModuleCode("MT") }; try { int result = mtm.Add(materialType); MaterialForm materialForm = (MaterialForm)this.Owner; if (result > 0) { materialForm.Isflag = true; MessageBox.Show("地区名称:" + textBox1.Text + " \n添加成功"); Close(); } else { materialForm.Isflag = false; MessageBox.Show("添加失败,请重新添加"); Close(); } } catch (Exception ex) { MessageBox.Show("新增地区资料错误,请检查服务器连接.错误信息:" + ex.Message); } } else { _MaterialType.MT_Name = textBox1.Text.Trim(); try { bool result = mtm.UpdateByCode(_MaterialType); if (result) { MaterialForm materialForm = (MaterialForm)this.Owner; materialForm.Isflag = true; MessageBox.Show("地区名称:" + textBox1.Text + " \n修改成功"); Close(); } else { MaterialForm materialForm = (MaterialForm)this.Owner; materialForm.Isflag = false; MessageBox.Show("修改失败,请重新修改"); Close(); } } catch (Exception ex) { MessageBox.Show("新增地区资料错误,请检查服务器连接.错误信息:" + ex.Message); } } }