/** * * 查询复验参数表信息* * ***/ protected void Select(object sender, EventArgs e) { //获取前台数据 string PN_HEAD = pn_head.Value; Pn_Leng(PN_HEAD, "Pn_head"); string REINSPECT_WEEK = reinspect_week.Value; Re_Leng(REINSPECT_WEEK, "复验周期"); //查询复验参数表数据 Reinspect_parameterDC reinspect_parameterDC = new Reinspect_parameterDC(); DataSet ds = new DataSet(); ds = reinspect_parameterDC.searchReinspect_parameters(PN_HEAD, REINSPECT_WEEK); if (ds == null) { if (PN_HEAD == string.Empty && REINSPECT_WEEK == string.Empty) { PageUtil.showToast(this, "复验参数表中无任何数据!"); } else { PageUtil.showToast(this, "复验参数表中无符合条件的数据!"); } } else { Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } }
/** * * 修改区域表信息* * ***/ protected void Update(object sender, EventArgs e) { //获取输入的数据 string UNIQUE_ID2 = Request.Form["unique_id2"]; string PN_HEAD2 = Request.Form["pn_head2"]; Pn_Leng(PN_HEAD2, "Pn_head"); string REINSPECT_WEEK2 = Request.Form["reinspect_week2"]; Re_Leng(REINSPECT_WEEK2, "复验周期"); string REINSPECT_QTY2 = ""; //修改数据 Reinspect_parameterDC reinspect_parameterDC = new Reinspect_parameterDC(); DataSet ds = new DataSet(); try { ds = reinspect_parameterDC.updateReinspect_parameters(UNIQUE_ID2, PN_HEAD2, REINSPECT_WEEK2, REINSPECT_QTY2); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); PageUtil.showToast(this, "修改复验参数表信息成功!"); } catch { PageUtil.showToast(this, "修改复验参数表信息失败!"); } }
protected void notarizeDelete(object sender, EventArgs e) { string customer_name = lab.Value; bool a = customer.deleteCustomers(customer_name); if (a == true) { try { string customer_code = code1.Value; string customer_name1 = user_name1.Value; customers = customer.getCustomersBySome(customer_name1, customer_code); Line_Repeater.DataSource = customers; Line_Repeater.DataBind(); user_name.Value = string.Empty; } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据失败,删除数据成功!"); return; } PageUtil.showToast(this.Page, "删除数据成功!"); } else { PageUtil.showToast(this.Page, "删除数据失败!"); } }
//查询制程表信息 protected void Select(object sender, EventArgs e) { string ROUTE_ID = Route_id.Value; string CREATE_BY_ID = Create_by_id.Value; Null_Num(CREATE_BY_ID, "创建者"); string UPDATE_BY_ID = Update_by_id.Value; Null_Num(UPDATE_BY_ID, "更新者"); Wip_operationDC wip_operationDC1 = new Wip_operationDC(); DataSet ds1 = new DataSet(); ds1 = wip_operationDC1.searchWip_operation(ROUTE_ID, CREATE_BY_ID, UPDATE_BY_ID); if (ds1 == null) { if (ROUTE_ID == string.Empty && CREATE_BY_ID == string.Empty && UPDATE_BY_ID == string.Empty) { PageUtil.showToast(this, "区域表中无任何数据!"); } else { PageUtil.showToast(this, "区域表中无符合条件的数据!"); } } else { Line_Repeater.DataSource = ds1; Line_Repeater.DataBind(); } }
//查询 protected void Select(object sender, EventArgs e) { string frame_name = Frame_name1.Value.Trim(); string enabled = Enabled1.Value.Trim(); if (enabled.Equals("ALL")) { enabled = ""; } string region_name = DropDownList2.SelectedValue; if (region_name == "ALL") { region_name = ""; } string create_by = Create_by1.Value; string update_by = Update_by1.Value; FrameDC frameDc = new FrameDC(); try { DataSet ds = frameDc.searchRegionByFourParameters(create_by, frame_name, update_by, enabled, region_name); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } catch (Exception ex) { PageUtil.showToast(this, "无相关数据!"); return; } }
//更新制程表信息 protected void Update(object sender, EventArgs e) { string ROUTE2 = Route2.Value; string ROUTE_ID2 = Route_id2.Value; Route_lg(ROUTE_ID2, "制程代号"); string DESCRIPTION_ID2 = Description_id2.Value; Desc_lg(DESCRIPTION_ID2, "描述"); string UPDATE_BY2 = Session["LoginName"].ToString(); Wip_operationDC wip_operationDC2 = new Wip_operationDC(); DataSet ds2 = new DataSet(); ds2 = wip_operationDC2.searchWip_operation(ROUTE_ID2, "", ""); try { ds2 = wip_operationDC2.updateWip_operation(ROUTE2, ROUTE_ID2, DESCRIPTION_ID2, UPDATE_BY2); Line_Repeater.DataSource = ds2; Line_Repeater.DataBind(); PageUtil.showToast(this, "更新成功"); } catch { PageUtil.showAlert(this, "更新数据失败"); } }
//删除数据 protected void notarizeDelete(object sender, EventArgs e) { int loginid = getLoginUserID(); if (loginid == -1) { return; } int vendor_id = -1; try { vendor_id = int.Parse(vendor_id_delete.Value.ToString()); } catch (Exception ex) { PageUtil.showToast(this, "数据异常,删除失败!"); return; } SupplierDC supplierDC = new SupplierDC(); if (supplierDC.deleteSupplier(vendor_id)) { PageUtil.showToast(this, "数据删除成功!"); string vendor_name1 = vendor_name_id.Value.Trim(); string vendor_key1 = vendor_key_id.Value.Trim(); Line_Repeater.DataSource = supplierDC.getSupplierBySome(vendor_name1, vendor_key1); Line_Repeater.DataBind(); } else { PageUtil.showToast(this, "数据删除失败!"); } }
//protected void cancelDelete(object sender, EventArgs e) //{ // lab.Value = string.Empty; //} protected void selectAll(object sender, EventArgs e) { try { string user_name = user_name1.Value; string enabled = Enabled1.Items[Enabled1.SelectedIndex].Value; string create_by = String.Empty; try { create_by = Session["LoginName"].ToString(); } catch (Exception ex1) { PageUtil.showToast(this.Page, "获取登录用户ID失败,请刷新页面或重新登录!"); return; } string department = Request.Form["Select1"]; string description = Textarea1.Value; users_dataset = user.getUsersBySome(create_by, user_name, description, enabled, department); Line_Repeater.DataSource = users_dataset; Line_Repeater.DataBind(); } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据失败!"); } }
//提交单头 protected void insert1(object sender, EventArgs e) { Return_headerDC DC = new Return_headerDC(); WoDC DC2 = new WoDC(); string invoice_no = invoice_no2.Value; string quit_type = quit_type1.Items[quit_type1.SelectedIndex].Value; int enabled = 0; int subinventory = 0; string remark = remark1.InnerText; string return_man = Session["LoginName"].ToString(); string wo_no = return_wo_no1.Value; if (String.IsNullOrEmpty(invoice_no)) { PageUtil.showToast(this.Page, "请点击插入自动生成单据号!"); } else if (String.IsNullOrEmpty(return_wo_no1.Value)) { PageUtil.showToast(this.Page, "请输入工单号!"); } List <ModelWO> wo; wo = DC2.getWOByWo_no(wo_no); if (wo == null) { PageUtil.showToast(this.Page, "没有这个工单号,请检查数据"); } else { try { enabled = int.Parse(Enabled1.Items[Enabled1.SelectedIndex].Value); subinventory = int.Parse(Subinventory1.Items[Subinventory1.SelectedIndex].Value); } catch (Exception ex) { PageUtil.showToast(this.Page, "数据转换出错,请检查数据格式!"); } bool a = DC.insertReturn_header(invoice_no, quit_type, subinventory, enabled, wo[0].Wo_key, return_man, remark); if (a == true) { PageUtil.showToast(this.Page, "添加退料单头成功!"); Line_Repeater.DataSource = DC.getReturn_headerByLikeINVOICE_NO(invoice_no); if (Line_Repeater.DataSource == null) { PageUtil.showToast(this, "数据库中没有对应数据,请添加数据后再查询"); } else { Line_Repeater.DataBind(); } } else { PageUtil.showToast(this.Page, "添加退料单头失败!"); } } }
protected void clear(object sender, EventArgs e) { vendor_name_id.Value = string.Empty; vendor_key_id.Value = string.Empty; Line_Repeater.DataSource = new DataTable(); Line_Repeater.DataBind(); PageUtil.showToast(this, "清除成功!"); }
//更新单头 protected void update1(object sender, EventArgs e) { Return_headerDC DC = new Return_headerDC(); WoDC woDC = new WoDC(); string invoice_no = quit_invoice_no2.Value; string quit_type = quit_type2.Items[quit_type2.SelectedIndex].Value; int subinventory = 0; int status = 0; int quit_wo_no = 0; string remark = remark2.Value; string return_man = Session["LoginName"].ToString(); if (String.IsNullOrEmpty(quit_wo_no2.Value)) { PageUtil.showToast(this.Page, "请输入工单号!"); } else { try { subinventory = int.Parse(Subinventory4.Items[Subinventory4.SelectedIndex].Value); status = int.Parse(status2.Items[status2.SelectedIndex].Value); quit_wo_no = woDC.getWo_keyByReturn_wo_no(quit_wo_no2.Value); } catch (Exception ex) { PageUtil.showToast(this.Page, "数据转换出错,请检查数据格式!"); return; } bool a = DC.updateReturn_header(invoice_no, quit_type, subinventory, status, quit_wo_no, return_man, remark); if (a == true) { try { Line_Repeater.DataSource = DC.getReturn_headerByLikeINVOICE_NO(invoice_no); if (Line_Repeater.DataSource == null) { PageUtil.showToast(this, "数据库中没有对应数据,请添加数据后再查询"); } Line_Repeater.DataBind(); } catch (Exception ex) { PageUtil.showToast(this.Page, "数据查询失败!"); } PageUtil.showToast(this.Page, "单据号为" + invoice_no + "更新成功!"); } else { PageUtil.showToast(this.Page, "单据号为" + invoice_no + "更新失败!"); } } }
//删除单头 protected void delete1(object sender, EventArgs e) { Return_headerDC DC = new Return_headerDC(); string invoice_no = lab1.Value; bool a = DC.deleteReturn_header(invoice_no); if (a == true) { string invoice_no1 = invoice_no4.Value; try { Line_Repeater.DataSource = DC.getReturn_headerByLikeINVOICE_NO(invoice_no1); if (Line_Repeater.DataSource == null) { PageUtil.showToast(this, "数据库中没有对应数据,请添加数据后再查询"); } else { Line_Repeater.DataBind(); } } catch (Exception ex) { PageUtil.showToast(this.Page, "数据查询失败!"); } Return_lineDC DC1 = new Return_lineDC(); string return_wo_no = return_wo_no4.Value; try { Repeater1.DataSource = DC1.getReturn_lineByLikeRETURN_WO_NO(return_wo_no); if (Repeater1.DataSource == null) { PageUtil.showToast(this, "数据库中没有对应数据,请添加数据后再查询"); } else { Repeater1.DataBind(); } } catch (Exception ex) { PageUtil.showToast(this.Page, "数据查询错误!"); } PageUtil.showToast(this.Page, "单据号" + invoice_no + "删除成功!"); } else { PageUtil.showToast(this.Page, "单据号" + invoice_no + "删除失败!"); } }
protected void selectSomeBySome(object sender, EventArgs e) { try { string customer_code = code1.Value; string customer_name = user_name1.Value; customers = customer.getCustomersBySome(customer_name, customer_code); Line_Repeater.DataSource = customers; Line_Repeater.DataBind(); } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据失败!"); } }
//查询 protected void selectSome(object sender, EventArgs e) { string vendor_name = vendor_name_id.Value.Trim(); string vendor_key = vendor_key_id.Value.Trim(); SupplierDC supplierDC = new SupplierDC(); DataSet ds = supplierDC.getSupplierBySome(vendor_name, vendor_key); if (ds == null) { PageUtil.showToast(this, "未查询到数据!"); return; } Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); }
//删除删除一条制程数据 protected void Delete(object sender, EventArgs e) { string ROUTE_ID3 = Route_id3.Value; Wip_operationDC wip_operationDC3 = new Wip_operationDC(); DataSet ds3 = new DataSet(); try { ds3 = wip_operationDC3.deleteWip_operation(ROUTE_ID3); Line_Repeater.DataSource = ds3; Line_Repeater.DataBind(); PageUtil.showToast(this, "删除成功"); } catch { PageUtil.showAlert(this, "删除失败"); } }
/** * * 删除区域表信息* * * **/ protected void Delete(object sender, EventArgs e) { //取主键(Unique_id)的值 string UNIQUE_ID3 = Request.Form["unique_id3"]; //删除复验参数数据 Reinspect_parameterDC reinspect_parameterDC = new Reinspect_parameterDC(); DataSet ds = new DataSet(); try { ds = reinspect_parameterDC.deleteReinspect_parameters(UNIQUE_ID3); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } catch { PageUtil.showToast(this, "删除复验参数表信息失败!"); } }
/** * * 新增复验参数表信息* * ***/ protected void Insert(object sender, EventArgs e) { //获取输入的数据 string PN_HEAD1 = pn_head1.Value; Pn_Leng(PN_HEAD1, "Pn_head"); string REINSPECT_WEEK1 = reinspect_week1.Value; Re_Leng(REINSPECT_WEEK1, "复验周期"); string REINSPECT_QTY1 = ""; //判断输入是否全为空 if (PN_HEAD1 == string.Empty && REINSPECT_WEEK1 == string.Empty) { PageUtil.showToast(this, "新增复验参数表数据的输入不能全为空!"); return; } //将数据插入数据表 Reinspect_parameterDC reinspect_parameterDC = new Reinspect_parameterDC(); DataSet ds = new DataSet(); ds = reinspect_parameterDC.searchReinspect_parameters(PN_HEAD1, ""); if (ds != null) { PageUtil.showToast(this, "该Pn_head已存在!"); } else { try { ds = reinspect_parameterDC.insertReinspect_parameters(PN_HEAD1, REINSPECT_WEEK1, REINSPECT_QTY1); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } catch { PageUtil.showToast(this, "新增复验参数表信息失败!"); } } }
/** * * 查询区域表信息* * ***/ protected void Select(object sender, EventArgs e) { //获取前台数据 string REGION_NAME = region_name.Value; Re_Leng(REGION_NAME, "区域名"); string SUBINVENTORY_KEY = Request.Form["subinventory_name"]; if (SUBINVENTORY_KEY == "ALL") { SUBINVENTORY_KEY = ""; } string CREATE_BY = create_by.Value; string ENABLED = enabled.Value; if (ENABLED == "ALL") { ENABLED = ""; } //查询区域表数据 RegionDC regionDC = new RegionDC(); DataSet ds = new DataSet(); ds = regionDC.searchRegionByFourParameters(REGION_NAME, SUBINVENTORY_KEY, CREATE_BY, ENABLED); if (ds == null) { if (REGION_NAME == string.Empty && SUBINVENTORY_KEY == string.Empty && CREATE_BY == string.Empty && ENABLED == string.Empty) { PageUtil.showToast(this, "区域表中无任何数据!"); } else { PageUtil.showToast(this, "区域表中无符合条件的数据!"); } } else { Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); } }
/** * * 删除区域表信息* * * **/ protected void Delete(object sender, EventArgs e) { //取主键(区域)的值 string REGION_KEY1 = Request.Form["region_key3"]; //删除区域数据 RegionDC regionDC3 = new RegionDC(); DataSet ds = new DataSet(); try { ds = regionDC3.deleteRegionById(REGION_KEY1); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); PageUtil.showToast(this, "删除区域表信息成功!"); } catch { PageUtil.showAlert(this, "删除区域表信息失败!"); } }
//查询单头 protected void select1(object sender, EventArgs e) { Return_headerDC DC = new Return_headerDC(); string invoice_no = invoice_no4.Value; try { Line_Repeater.DataSource = DC.getReturn_headerByLikeINVOICE_NO(invoice_no); if (Line_Repeater.DataSource == null) { PageUtil.showToast(this, "数据库中没有对应数据,请添加数据后再查询"); } else { Line_Repeater.DataBind(); } } catch (Exception ex) { PageUtil.showToast(this.Page, "数据查询失败!"); } }
//更新数据 protected void notarizeUpdate(object sender, EventArgs e) { int loginid = getLoginUserID(); if (loginid == -1) { return; } string vendor_id = vendor_id_update.Value.Trim(); string vendor_name = vendor_name_update.Value.Trim(); string vendor_key = vendor_key_update.Value.Trim(); if (!checkData(vendor_name, vendor_key)) { return; } SupplierDC supplierDC = new SupplierDC(); DataSet search_ds = supplierDC.getSupplierByNameAndKeyAndId(vendor_id, vendor_name, vendor_key); //如过大于2,则数据库中已存在该name和key,否则 就可以更新 if (search_ds != null && search_ds.Tables[0].Rows.Count > 0) { PageUtil.showToast(this, "供应商名称或者供应商代码已存在!"); return; } if (supplierDC.updateSupplier(vendor_id, vendor_name, loginid, vendor_key, DateTime.Now)) { PageUtil.showToast(this, "数据更新成功!"); string vendor_name1 = vendor_name_id.Value.Trim(); string vendor_key1 = vendor_key_id.Value.Trim(); Line_Repeater.DataSource = supplierDC.getSupplierBySome(vendor_name1, vendor_key1); Line_Repeater.DataBind(); } else { PageUtil.showToast(this, "数据更新失败!"); } }
//插入数据 protected void Insert(object sender, EventArgs e) { string ROUTE_ID1 = Route_id1.Value; Route_lg(ROUTE_ID1, "制程代号"); string DESCRIPTION_ID1 = Description_id1.Value; Desc_lg(DESCRIPTION_ID1, "描述"); string CREATE_BY1 = Session["LoginName"].ToString(); Wip_operationDC wip_operationDC = new Wip_operationDC(); DataSet ds = new DataSet(); ds = wip_operationDC.searchWip_operation(ROUTE_ID1, "", ""); if (ds != null) { PageUtil.showAlert(this, "该制程代号已存在"); Route_id1.Value = null; Description_id1.Value = null; return; } else { try { ds = wip_operationDC.insertWip_operation(ROUTE_ID1, DESCRIPTION_ID1, CREATE_BY1); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); PageUtil.showToast(this, "插入数据成功"); Route_id1.Value = null; Description_id1.Value = null; } catch { PageUtil.showAlert(this, "插入数据失败!"); } } }
//protected void cancelUpdate(object sender, EventArgs e) //{ // Enabled2.SelectedIndex = 0; // Department2.SelectedIndex = 0; // Description2.Value = string.Empty; //} protected void notarizeDelete(object sender, EventArgs e) { int user_id = Int32.Parse(lab.Value); bool a = user.deleteUsers(user_id); string create_by = String.Empty; try { create_by = Session["LoginName"].ToString(); } catch (Exception ex1) { PageUtil.showToast(this.Page, "获取登录用户ID失败,请刷新页面或重新登录!"); return; } if (a == true) { try { string user_name2 = user_name1.Value; string enabled1 = Enabled1.Items[Enabled1.SelectedIndex].Value; string department1 = Request.Form["Select1"]; string description1 = Textarea1.Value; users_dataset = user.getUsersBySome(create_by, user_name2, description1, enabled1, department1); Line_Repeater.DataSource = users_dataset; Line_Repeater.DataBind(); } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据成功,删除数据失败!"); } PageUtil.showToast(this.Page, "删除数据成功!"); } else { PageUtil.showToast(this.Page, "删除数据成功!"); } }
/** * * 修改区域表信息* * ***/ protected void Update(object sender, EventArgs e) { //获取输入的数据 string REGION_KEY = Request.Form["region_key2"]; string REGION_NAME2 = Request.Form["region_name2"]; Re_Leng(REGION_NAME2, "区域名"); string SUBINVENTORY_KEY2 = Request.Form["subinventory_name2"]; string ENABLED2 = Request.Form["enabled2"]; string DESCRIPTION2 = Request.Form["description2"]; Des_Leng(DESCRIPTION2, "描述"); string UPDATE_BY2 = Session["LoginName"].ToString(); //判断更改者是否为空 if (Session["LoginId"] == null) { PageUtil.showToast(this, "更改者为空!"); return; } //修改数据 RegionDC regionDC2 = new RegionDC(); DataSet ds = new DataSet(); try { ds = regionDC2.updateRegion(REGION_KEY, REGION_NAME2, SUBINVENTORY_KEY2, UPDATE_BY2, ENABLED2, DESCRIPTION2); Line_Repeater.DataSource = ds; Line_Repeater.DataBind(); PageUtil.showToast(this, "修改区域表信息成功!"); } catch { PageUtil.showToast(this, "修改区域表信息失败!"); } }
//插入数据 protected void notarizeInsert(object sender, EventArgs e) { int loginid = getLoginUserID(); if (loginid == -1) { return; } string vendor_name = vendor_name_insert.Value.Trim(); string vendor_key = vendor_key_insert.Value.Trim(); if (!checkData(vendor_name, vendor_key)) { return; } SupplierDC supplierDC = new SupplierDC(); DataSet search_ds = supplierDC.getSupplierByNameAndKey(vendor_name, vendor_key); if (search_ds != null && search_ds.Tables[0].Rows.Count > 0) { PageUtil.showToast(this, "供应商名称或者供应商代码已存在!"); return; } else if (supplierDC.insertSupplier(vendor_name, loginid, vendor_key, DateTime.Now)) { PageUtil.showToast(this, "数据插入成功!"); vendor_name_insert.Value = ""; vendor_key_insert.Value = ""; Line_Repeater.DataSource = supplierDC.getSupplierBySome("", ""); Line_Repeater.DataBind(); } else { PageUtil.showToast(this, "数据插入失败!"); } }
protected void notarizeAdd(object sender, EventArgs e) { string user_name = Frame_name.Value.Trim(); string enabled = Enabled.Items[Enabled.SelectedIndex].Value.Trim(); string department = Request.Form["Department"]; string description = Description.Value.Trim(); if (description.Length >= 20) { PageUtil.showToast(this.Page, "描述太长!"); } else if (user_name.Length >= 20) { PageUtil.showToast(this.Page, "用户名太长!"); } else if (string.IsNullOrEmpty(user_name)) { PageUtil.showToast(this.Page, "请输入用户名!"); } else { string create_by = String.Empty; try { create_by = Session["LoginName"].ToString(); } catch (Exception ex1) { PageUtil.showToast(this.Page, "获取登录用户ID失败,请刷新页面或重新登录!"); return; } DataSet ds = user.getUser(user_name); if (ds.Tables[0].Rows.Count == 0) { bool a = user.insertUsers(user_name, description, enabled, create_by, department); if (a == true) { try { string user_name2 = user_name1.Value; string enabled1 = Enabled1.Items[Enabled1.SelectedIndex].Value; string department1 = Request.Form["Select1"]; string description1 = Textarea1.Value; users_dataset = user.getUsersBySome(create_by, user_name2, description1, enabled1, department1); Line_Repeater.DataSource = users_dataset; Line_Repeater.DataBind(); } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据出错,添加数据成功!"); } Frame_name.Value = string.Empty; Enabled.SelectedIndex = 0; Description.Value = string.Empty; PageUtil.showToast(this.Page, "添加数据成功!"); } else { PageUtil.showToast(this.Page, "添加数据失败!"); } } else { PageUtil.showToast(this.Page, "用户已存在,添加失败!"); } } }
protected void clear(object sender, EventArgs e) { Line_Repeater.DataBind(); Repeater1.DataBind(); PageUtil.showToast(this, "成功清除查询结果"); }
protected void notarizeUpdate(object sender, EventArgs e) { string user_id = String.Empty; try { user_id = Session["LoginName"].ToString(); } catch (Exception ex1) { PageUtil.showToast(this.Page, "获取登录用户ID失败,请刷新页面或重新登录!"); return; } string customer_key = Label2.Value; string customer_name = user_name2.Value; int key = int.Parse(key1.Value); if (customer_name.Length >= 10) { PageUtil.showToast(this.Page, "客户名长度过长!"); } else if (customer_key.Length >= 10) { PageUtil.showToast(this.Page, "客户代码过长!"); } else if (customer_key.Length == 0) { PageUtil.showToast(this.Page, "请输入客户名代码"); } else if (customer_name.Length == 10) { PageUtil.showToast(this.Page, "请输入客户名称"); } else { DataSet ds = customer.getCustomerCount(customer_key, customer_name); var count = ds.Tables[0].Rows.Count; if (ds.Tables[0].Rows.Count < 2) { DateTime update_time = DateTime.Now; bool a = customer.updateCustomers(customer_name, user_id, update_time, customer_key, key); if (a == true) { try { string customer_name1 = user_name1.Value; string customer_code = code1.Value; customers = customer.getCustomersBySome(customer_name1, customer_code); Line_Repeater.DataSource = customers; Line_Repeater.DataBind(); user_name.Value = string.Empty; } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据失败,更新数据成功!"); } PageUtil.showToast(this.Page, "更新数据成功!"); } else { PageUtil.showToast(this.Page, "更新数据失败!"); } } else { PageUtil.showToast(this.Page, "客户名已存在,更新失败!"); } } }
//protected void cancelAdd(object sender, EventArgs e) //{ // Frame_name.Value = string.Empty; // Enabled.SelectedIndex = 0; // Department.SelectedIndex = 0; // Description.Value = string.Empty; //} protected void notarizeUpdate(object sender, EventArgs e) { int user_id = Int32.Parse(Label2.Value); string user_name = Frame_name2.Value; string enabled = Enabled2.Value; string department = Request.Form["Department2"]; string description = Description2.Value; DateTime updateTime = DateTime.Now; if (user_name.Length >= 20) { PageUtil.showToast(this.Page, "用户名长度过长!"); } else if (description.Length >= 20) { PageUtil.showToast(this.Page, "描述长度过长!"); } else if (user_name.Length == 0) { PageUtil.showToast(this.Page, "请输入用户名"); } else { string create_by = String.Empty; try { create_by = Session["LoginName"].ToString(); } catch (Exception ex1) { PageUtil.showToast(this.Page, "获取登录用户ID失败,请刷新页面或重新登录!"); return; } try{ bool a = user.updateUsers(user_id, user_name, description, enabled, create_by, department, updateTime); if (a == true) { try { string user_name2 = user_name1.Value; string enabled1 = Enabled1.Items[Enabled1.SelectedIndex].Value; string department1 = Request.Form["Select1"]; string description1 = Textarea1.Value; users_dataset = user.getUsersBySome(create_by, user_name2, description1, enabled1, department1); Line_Repeater.DataSource = users_dataset; Line_Repeater.DataBind(); } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据失败,更新数据成功!"); } PageUtil.showToast(this.Page, "更新数据成功!"); } else { PageUtil.showToast(this.Page, "用户名已存在!"); } } catch (Exception ex) { PageUtil.showToast(this.Page, "更新失败!"); } } }
protected void notarizeInsert(object sender, EventArgs e) { string customer_name = user_name.Value; string code = customer_code1.Value; if (customer_name.Length >= 10) { PageUtil.showToast(this.Page, "客户名长度过长!"); } else if (code.Length >= 10) { PageUtil.showToast(this.Page, "客户代码长度过长!"); } else if (code.Length == 0) { PageUtil.showToast(this.Page, "客户代码为空"); } else if (customer_name.Length == 0) { PageUtil.showToast(this.Page, "客户名称为空"); } else { string user_id = String.Empty; try { user_id = Session["LoginName"].ToString(); } catch (Exception ex1) { PageUtil.showToast(this.Page, "获取登录用户ID失败,请刷新页面或重新登录!"); return; } DataSet ds = customer.getCustomer(customer_name); DataSet ds2 = customer.getCustomer2(code); if (ds.Tables[0].Rows.Count == 0 && ds2.Tables[0].Rows.Count == 0) { bool a = customer.insertCustomers(customer_name, user_id, code); if (a == true) { try { string customer_name1 = user_name1.Value; string customer_code = code1.Value; customers = customer.getCustomersBySome(customer_name1, customer_code); Line_Repeater.DataSource = customers; Line_Repeater.DataBind(); user_name.Value = string.Empty; } catch (Exception e1) { PageUtil.showToast(this.Page, "查询数据失败,添加数据成功!"); } PageUtil.showToast(this.Page, "添加数据成功!"); } else { PageUtil.showToast(this.Page, "添加数据失败!"); } } else { PageUtil.showToast(this.Page, "客户名或客户代码已存在,无法添加!"); } } }