protected void btnAdd_Click(object sender, EventArgs e) { if (checkInput() != true) { return; } Id = CommadMethod.getNextId("Fix" + DateTime.Now.ToString("yyyyMMdd"), "").Trim(); string docType = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); imgId = Id + docType; InsertCommandBuilder ins = new InsertCommandBuilder("Repair_records"); ins.InsertColumn("id", Id); ins.InsertColumn("eqp_no", tags.Text); ins.InsertColumn("rely_date", txtDate.Text); ins.InsertColumn("repair_time", Convert.ToDecimal(txtHours.Text)); ins.InsertColumn("repair_record", txtRecords.Text); ins.InsertColumn("type", ddlType.SelectedItem.Text); ins.InsertColumn("rely_dept", ddlDept.SelectedItem.Text); string person = string.Empty; for (int i = 0; i < cblPerson.Items.Count; i++) { if (cblPerson.Items[i].Selected == true) { person += cblPerson.Items[i].Text + ","; } } if (!string.IsNullOrEmpty(txtPerson.Text)) { person += txtPerson.Text; } else { person = person.Substring(0, person.Length - 1); } ins.InsertColumn("repairman", person); ins.InsertColumn("create_date", "getdate()"); ins.InsertColumn("doc_url", imgId); ins.getInsertCommand(); int count = ins.ExecuteNonQuery(); if (count != 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('添加成功')</script>", false); uploadImg(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('添加失败')</script>", false); } }
private static void InsertData(string label, string goodsName, int Qty, int areaId, string userId) { InsertCommandBuilder ins = new InsertCommandBuilder("Material_control"); ins.InsertColumn("label", label); ins.InsertColumn("goods_name", goodsName); ins.InsertColumn("process_id", areaId); ins.InsertColumn("qty", Qty); ins.InsertColumn("operate_time", "getDate()"); ins.InsertColumn("operator", userId); ins.getInsertCommand(); ins.ExecuteNonQuery(); }
public int excutInsert(string Barcode, string goods_name, int qty, string pdate, string sn, string customerID) { InsertCommandBuilder insert = new InsertCommandBuilder("BarCodeRecords"); insert.InsertColumn("Barcode", Barcode); insert.InsertColumn("goods_name", goods_name); insert.InsertColumn("qty", qty); insert.InsertColumn("pdate", pdate); insert.InsertColumn("sn", sn); insert.InsertColumn("customerId", customerID); insert.InsertColumn("create_date", "getdate()"); insert.getInsertCommand(); return(insert.ExecuteNonQuery()); }
protected void gvData_RowDeleting(object sender, GridViewDeleteEventArgs e) { string sql = "delete from pre_prd_pk where prd_pk_id = '" + gvData.Rows[e.RowIndex].Cells[2].Text.Trim() + "'"; string sqldetail = "delete from pre_prd_pk_detail where prd_pk_id = '" + gvData.Rows[e.RowIndex].Cells[2].Text.Trim() + "'"; List <string> sList = new List <string>(); sList.Add(sql); sList.Add(sqldetail); InsertCommandBuilder ins = new InsertCommandBuilder(); int count = ins.ExecuteNonQuery(sql); count += ins.ExecuteNonQuery(sqldetail); if (count != 0) { gvData.DataSource = getData(); gvData.DataBind(); } else { Response.Write("<script>alert('" + Resources.Resource.alterfiald + "')</script>"); return; } }
protected void Button1_Click(object sender, EventArgs e) { string userID = TextBox1.Text; string department = TextBox2.Text; string name = TextBox3.Text; InsertCommandBuilder icd = new InsertCommandBuilder(); string sqlinsert = @"insert into shatter_Parts_Password (userid,department,name) values('" + userID + "','" + department + "','" + name + "')"; Debug.WriteLine(sqlinsert); icd.ExecuteNonQuery(sqlinsert); Response.Redirect("UserManage.aspx"); }
protected void btnSure_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtinvoice_date.Text)) { txtinvoice_date.Focus(); return; } if (string.IsNullOrEmpty(txtRecipt_Date.Text)) { txtRecipt_Date.Focus(); return; } if (string.IsNullOrEmpty(txtAmount.Text)) { txtAmount.Focus(); return; } InsertCommandBuilder ins = new InsertCommandBuilder("Mode_receipt_accounting"); ins.InsertColumn("receipt_date", txtRecipt_Date.Text); ins.InsertColumn("Amount", double.Parse(txtAmount.Text).ToString("0.00#")); ins.InsertColumn("M_id", Id); ins.InsertColumn("invoice_date", txtinvoice_date.Text); if (!string.IsNullOrEmpty(txtinvoice_no.Text)) { ins.InsertColumn("invoice_no", txtinvoice_no.Text); } ins.getInsertCommand(); int count = ins.ExecuteNonQuery(); if (count != 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "<script>alert('收款成功!')</script>"); getReciptData(Id); txtAmount.Text = string.Empty; txtRecipt_Date.Text = string.Empty; txtAmount.Focus(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "<script>alert('收款失败!')</script>"); } }
protected void btnEdit_Click(object sender, EventArgs e) { InsertCommandBuilder insert = new InsertCommandBuilder("m_materials"); insert.InsertColumn("name", txtName.Text); insert.InsertColumn("spec", txtSpec.Text); insert.InsertColumn("sccj_id", ddlVendor.SelectedItem.Value); insert.InsertColumn("new_price", txtPrie.Text); insert.InsertColumn("wb_name", moneyType.Text); insert.InsertColumn("lb1_id", type.Text); insert.InsertColumn("texture", txtCz.Text); insert.InsertColumn("color", txtColor.Text); insert.InsertColumn("dm", txtShotName.Text); insert.getInsertCommand(); int i = insert.ExecuteNonQuery(); if (i != 0) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "showwindow", "<script>alert('添加成功')</script>"); } }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTypeName.Text)) { return; } InsertCommandBuilder ins = new InsertCommandBuilder("Mode_type"); ins.InsertColumn("Mode_type_name", txtTypeName.Text.Trim()); ins.getInsertCommand(); int count = ins.ExecuteNonQuery(); if (count != 0) { getType(); txtTypeName.Text = string.Empty; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "<script>alert('添加成功!')</script>"); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "<script>alert('添加失败!')</script>"); } }
protected void btnEdit_Click(object sender, EventArgs e) { if (inputCheck() == true) { InsertCommandBuilder insert = new InsertCommandBuilder("vendor"); insert.InsertColumn("vendor_id", vendor_id.Text); insert.InsertColumn("vendor_aname", vendor_aname.Text.Trim()); insert.InsertColumn("vendor_name", vendor_name.Text.Trim()); insert.InsertColumn("vendor_address", vendor_address.Text.Trim()); insert.InsertColumn("city", city.Text.Trim()); insert.InsertColumn("tel", tel.Text.Trim()); insert.InsertColumn("fax", fax.Text.Trim()); insert.InsertColumn("contact", contact.Text.Trim()); insert.InsertColumn("crt_date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); insert.InsertColumn("operator_name", HttpContext.Current.Request.Cookies["cookie"].Values["id"]); insert.InsertColumn("is_sccj", cboIsSCCJ.Checked == true ? "是" : ""); insert.getInsertCommand(); int count = insert.ExecuteNonQuery(); if (count != 0) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "showwindow", "<script>alert('" + Resources.Resource.alterOk + "!')</script>"); getMaxId(); vendor_aname.Text = ""; vendor_name.Text = ""; vendor_address.Text = ""; city.Text = ""; tel.Text = ""; fax.Text = ""; contact.Text = ""; cboIsSCCJ.Checked = false; } } else { ClientScript.RegisterStartupScript(ClientScript.GetType(), "showwindow", "<script>alert('" + Resources.Resource.alerttx + "')</script>"); } }
protected int InsertData(string tableName, string id) { InsertCommandBuilder ins = new InsertCommandBuilder(constr, tableName); ins.InsertColumn("goods_id", id.ToString()); ins.InsertColumn("goods_name", txtgoodsName.Text.Trim().ToUpper()); ins.InsertColumn("goods_no", txtgoodsName.Text.Trim().ToUpper()); if (!string.IsNullOrEmpty(txtgoodsEName.Text.Trim())) { ins.InsertColumn("goods_ename", txtgoodsEName.Text.Trim()); } if (!string.IsNullOrEmpty(txtVersion.Text.Trim())) { ins.InsertColumn("Version", txtVersion.Text.Trim().ToUpper()); } if (!string.IsNullOrEmpty(txtjigNo.Text.Trim())) { ins.InsertColumn("mjh", txtjigNo.Text.Trim()); } if (!ddlMachine.SelectedItem.Value.Equals("0")) { ins.InsertColumn("dw", ddlMachine.SelectedItem.Value); } if (!string.IsNullOrEmpty(txtQty.Text.Trim())) { ins.InsertColumn("qs", txtQty.Text.Trim()); } if (!string.IsNullOrEmpty(txtMNo.Text.Trim())) { ins.InsertColumn("Materail_Number", txtMNo.Text.Trim()); } if (!string.IsNullOrEmpty(txtMName.Text.Trim())) { ins.InsertColumn("Materail_Name", txtMName.Text.Trim()); } if (!string.IsNullOrEmpty(txtMColor.Text.Trim())) { ins.InsertColumn("ys", txtMColor.Text.Trim()); } if (!string.IsNullOrEmpty(txtMModel.Text.Trim())) { ins.InsertColumn("Materail_Model", txtMModel.Text.Trim()); } if (!string.IsNullOrEmpty(txtMVenderColor.Text.Trim())) { ins.InsertColumn("Materail_Vender_Color", txtMVenderColor.Text.Trim()); } if (!string.IsNullOrEmpty(txtColor.Text.Trim())) { ins.InsertColumn("Materail_Color", txtColor.Text.Trim()); } if (!string.IsNullOrEmpty(txtWeight.Text.Trim())) { ins.InsertColumn("cpdz", txtWeight.Text.Trim()); } if (!string.IsNullOrEmpty(txtSKWeight.Text.Trim())) { ins.InsertColumn("skdz", txtSKWeight.Text.Trim()); } if (!string.IsNullOrEmpty(txtTemp.Text.Trim())) { ins.InsertColumn("Drying_Temperature", txtTemp.Text.Trim()); } if (!string.IsNullOrEmpty(txtTime.Text.Trim())) { ins.InsertColumn("Drying_Time", txtTime.Text.Trim()); } if (!string.IsNullOrEmpty(txtCrushedscale.Text.Trim())) { ins.InsertColumn("sk_scale", Convert.ToDecimal(txtCrushedscale.Text.Trim().Split('%')[0]) / 100); } if (!string.IsNullOrEmpty(txtCycle.Text.Trim())) { ins.InsertColumn("cxzq", txtCycle.Text.Trim()); } if (!ddlCustomer.SelectedItem.Value.Equals("0")) { ins.InsertColumn("khdm", ddlCustomer.SelectedItem.Value); } if (!string.IsNullOrEmpty(txtRemark.Text.Trim())) { ins.InsertColumn("remark", txtRemark.Text.Trim()); } if (!string.IsNullOrEmpty(txtLevel.Text.Trim())) { ins.InsertColumn("Fire_Retardant_Grade", txtLevel.Text.Trim()); } if (!string.IsNullOrEmpty(txtBuyer.Text.Trim())) { ins.InsertColumn("Buyer", txtBuyer.Text.Trim()); } if (!string.IsNullOrEmpty(txtCModel.Text.Trim())) { ins.InsertColumn("Toner_Model", txtCModel.Text.Trim()); } if (!string.IsNullOrEmpty(txtCBuyer.Text.Trim())) { ins.InsertColumn("Toner_Buyer", txtCBuyer.Text.Trim()); } if (!string.IsNullOrEmpty(txtAircraft.Text.Trim())) { ins.InsertColumn("Aircraft", txtAircraft.Text.Trim()); } if (!string.IsNullOrEmpty(txtCharge.Text.Trim())) { ins.InsertColumn("Model_Abrasives", txtCharge.Text.Trim()); } if (!string.IsNullOrEmpty(txtlb7.Text)) { ins.InsertColumn("Semi_Product_Goods", txtlb7.Text.Trim()); } if (ddlLb7.SelectedItem.Value != "00") { ins.InsertColumn("Semi_Product_Type", ddlLb7.SelectedItem.Value); } ins.InsertColumn("crt_date", "getdate()"); ins.InsertColumn("Model_Type", ddlModeType.SelectedItem.Value); ins.InsertColumn("Rohs_Certification", ddlROHS.SelectedItem.Text); ins.getInsertCommand(); return(ins.ExecuteNonQuery()); }
protected void btnAdd_Click(object sender, EventArgs e) { if (true) { if (ddlMode_Type.SelectedIndex == 0) { return; } } InsertCommandBuilder ins = new InsertCommandBuilder("Mold_management_accounting"); string id = CommadMethod.getNextId("M" + DateTime.Now.ToString("yyyyMMddHHmm"), ""); ins.InsertColumn("id", id); ins.InsertColumn("type_id", ddlMode_Type.SelectedItem.Value); ins.InsertColumn("mode", txtMode.Text.Trim()); ins.InsertColumn("goods_name", txtGoods_Name.Text.Trim()); ins.InsertColumn("goods_no", txtGoods_No.Text.Trim()); ins.InsertColumn("qty", int.Parse(txtCount.Text.Trim())); ins.InsertColumn("quotation_number", txtQuotation_number.Text.Trim()); ins.InsertColumn("price", double.Parse(txtPrice.Text)); ins.InsertColumn("rate", double.Parse(txtRate.Value)); ins.InsertColumn("total", double.Parse(txtTotal.Value)); ins.InsertColumn("currency", ddlCurrency.Text); ins.InsertColumn("order_receipt_date", txtRecive_Date.Text); ins.InsertColumn("delivery_date", txtDelivery_Date.Text); ins.InsertColumn("tax_rate", double.Parse(rate)); if (!string.IsNullOrEmpty(txtContent_Remark.Text)) { ins.InsertColumn("content_remark", txtContent_Remark.Text); } if (!string.IsNullOrEmpty(txtdelivery_no.Text)) { ins.InsertColumn("delivery_no", txtdelivery_no.Text); } if (!string.IsNullOrEmpty(txtcustomer_order_no.Text)) { ins.InsertColumn("customer_order_no", txtcustomer_order_no.Text); } if (!string.IsNullOrEmpty(txtrevenue_time.Text)) { ins.InsertColumn("revenue_time", Convert.ToDateTime(txtrevenue_time.Text).ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(txtreconciliation_time.Text)) { ins.InsertColumn("reconciliation_time", txtreconciliation_time.Text); } if (!string.IsNullOrEmpty(txtreceipt_date.Text)) { ins.InsertColumn("receipt_date", txtreceipt_date.Text); } if (!string.IsNullOrEmpty(txtRemark.Text)) { ins.InsertColumn("remarks", txtRemark.Text); } ins.getInsertCommand(); int count = ins.ExecuteNonQuery(); if (count != 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "<script>alert('添加成功!')</script>"); clearTextBox(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "<script>alert('添加失败!')</script>"); } }
protected void gvGoodsData_SelectedIndexChanged(object sender, EventArgs e) { if (gvEditData.Rows.Count != 0) { AddData dataa = new AddData() { id = "", pm = this.gvGoodsData.SelectedRow.Cells[0].Text.Trim(), spec = this.gvGoodsData.SelectedRow.Cells[2].Text.Trim(), cz = this.gvGoodsData.SelectedRow.Cells[3].Text.Trim(), ys = this.gvGoodsData.SelectedRow.Cells[4].Text.Trim(), goods_unit = this.gvGoodsData.SelectedRow.Cells[5].Text.Trim(), pch = this.gvGoodsData.SelectedRow.Cells[6].Text == " " ? "" : this.gvGoodsData.SelectedRow.Cells[6].Text.Trim(), hwh = this.gvGoodsData.SelectedRow.Cells[7].Text == " " ? "" : this.gvGoodsData.SelectedRow.Cells[7].Text.Trim(), pdsl = this.gvGoodsData.SelectedRow.Cells[8].Text == " " ? "0" : Convert.ToDecimal(this.gvGoodsData.SelectedRow.Cells[8].Text).ToString("0.##"), Price = this.gvGoodsData.SelectedRow.Cells[9].Text == " " ? "0" : Convert.ToDecimal(this.gvGoodsData.SelectedRow.Cells[9].Text).ToString("0.##"), total = "0", customer_name = this.gvGoodsData.SelectedRow.Cells[10].Text.Trim(), }; List <string> sList = getBatch_id(dataa.pm, dataa.pch); InsertCommandBuilder ins = new InsertCommandBuilder("pd_detail"); string Bill_id = ViewState["billId"].ToString(); ins.InsertColumn("Bill_id", Bill_id); ins.InsertColumn("prd_Batch_id", sList[1].Trim()); ins.InsertColumn("materials_id", sList[0].Trim()); ins.InsertColumn("Qty", dataa.pdsl); ins.InsertColumn("Pch", dataa.pch); string detail_id = new SelectCommandBuilder().ExecuteDataTable("SELECT MAX(Detail_id) AS maxId FROM pd_detail where bill_id = '" + Bill_id + "'").Rows[0][0].ToString(); int i = Convert.ToInt32(detail_id.Substring(detail_id.Length - 4, 4)); ins.InsertColumn("Detail_id", Bill_id + (i + 1).ToString().PadLeft(4, '0')); ins.InsertColumn("Price", dataa.Price); ins.InsertColumn("is_can_sale", "Y"); ins.InsertColumn("hwh", dataa.hwh); ins.InsertColumn("is_new", "Y"); ins.getInsertCommand(); ins.ExecuteNonQuery(); //if (aList.Count==0) //{ // btnSelect_Click(sender, e); //} trgoods.Visible = false; AddData data1 = new AddData() { id = Bill_id + (i + 1).ToString().PadLeft(4, '0'), pm = this.gvGoodsData.SelectedRow.Cells[0].Text.Trim(), spec = this.gvGoodsData.SelectedRow.Cells[2].Text.Trim(), cz = this.gvGoodsData.SelectedRow.Cells[3].Text.Trim(), ys = this.gvGoodsData.SelectedRow.Cells[4].Text.Trim(), goods_unit = this.gvGoodsData.SelectedRow.Cells[5].Text.Trim(), pch = this.gvGoodsData.SelectedRow.Cells[6].Text == " " ? "" : this.gvGoodsData.SelectedRow.Cells[6].Text.Trim(), hwh = this.gvGoodsData.SelectedRow.Cells[7].Text == " " ? "" : this.gvGoodsData.SelectedRow.Cells[7].Text.Trim(), pdsl = this.gvGoodsData.SelectedRow.Cells[8].Text == " " ? "0" : Convert.ToDecimal(this.gvGoodsData.SelectedRow.Cells[8].Text).ToString("0.##"), Price = this.gvGoodsData.SelectedRow.Cells[9].Text == " " ? "0" : Convert.ToDecimal(this.gvGoodsData.SelectedRow.Cells[9].Text).ToString("0.##"), total = "0", customer_name = this.gvGoodsData.SelectedRow.Cells[10].Text.Trim(), }; aList.Insert(0, data1); gvAddData.DataSource = aList; gvAddData.DataBind(); return; } AddData data = new AddData() { id = "", pm = this.gvGoodsData.SelectedRow.Cells[0].Text.Trim(), spec = this.gvGoodsData.SelectedRow.Cells[2].Text.Trim(), cz = this.gvGoodsData.SelectedRow.Cells[3].Text.Trim(), ys = this.gvGoodsData.SelectedRow.Cells[4].Text.Trim(), goods_unit = this.gvGoodsData.SelectedRow.Cells[5].Text.Trim(), pch = this.gvGoodsData.SelectedRow.Cells[6].Text == " " ? "" : this.gvGoodsData.SelectedRow.Cells[6].Text.Trim(), hwh = this.gvGoodsData.SelectedRow.Cells[7].Text == " " ? "" : this.gvGoodsData.SelectedRow.Cells[7].Text.Trim(), pdsl = this.gvGoodsData.SelectedRow.Cells[8].Text == " " ? "0" : Convert.ToDecimal(this.gvGoodsData.SelectedRow.Cells[8].Text).ToString("0.##"), Price = this.gvGoodsData.SelectedRow.Cells[9].Text == " " ? "0" : Convert.ToDecimal(this.gvGoodsData.SelectedRow.Cells[9].Text).ToString("0.##"), total = "0", customer_name = this.gvGoodsData.SelectedRow.Cells[10].Text.Trim(), s_id = this.gvGoodsData.SelectedRow.Cells[11].Text.Trim(), b_id = this.gvGoodsData.SelectedRow.Cells[12].Text.Trim() }; lList.Insert(0, data); gvAddData.DataSource = lList; gvAddData.DataBind(); (gvAddData.Rows[0].Cells[7].FindControl("txtpdsl") as TextBox).Attributes.Add("onfocus", "this.select();"); Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", "<script>document.all.gvAddData_ctl02_txtpdsl.focus()</script>"); gvGoodsData.DataSource = null; gvGoodsData.DataBind(); gvAddData.Columns[11].Visible = true; gvAddData.Columns[12].Visible = false; trgoods.Visible = false; }