protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //PubFunc.DdlDataGet("DDL_SYS_DEPOT", docDEPTOUT); //PubFunc.DdlDataGet("DDL_SYS_DEPOTRANGE", UserAction.UserID, docDEPTOUT); PubFunc.DdlDataGet("DDL_SYS_DEPTRANGE", UserAction.UserID, docDEPTID); //PubFunc.DdlDataGet(docCATID, "DDL_SYS_CATEGORY_TYPE"); //docCATID.SelectedValue = "2"; GridStrategy.DataSource = GridTemplate(""); GridStrategy.DataBind(); } }
private void DataQuery() { string text = trbSearch.Text.Trim(); DataTable dt = new DataTable(); if (text.Trim().Length > 0) { string strWhere = string.Format("AND (GROUPNAME LIKE '%{0}%' OR DEPTID LIKE '%{0}%')", text); dt = GridTemplate(strWhere); } else { dt = GridTemplate(""); //DataRow[] drArr = dt.Select(string.Format("GROUPNAME LIKE '%{0}%' OR DEPT LIKE '%{0}%'", text)); //dtNew = dt.Clone();//克隆dt的整个类型 //foreach (DataRow dr in drArr) //{ // dtNew.Rows.Add(dr.ItemArray); //} } GridStrategy.DataSource = dt; GridStrategy.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(docGROUPNAME.Text)) { Alert.Show("请输入模板名称!", "警告提醒", MessageBoxIcon.Warning); return; } if (docGROUPNAME.Text.Length > 50) { Alert.Show("输入的模板名称超过字数限制!", "警告提醒", MessageBoxIcon.Warning); return; } if (ddlTYPE.SelectedValue == "") { Alert.Show("请选择申请模板!", "警告提醒", MessageBoxIcon.Warning); return; } if (hfdGROUPID.Text == "") { hfdGROUPID.Text = GetCode(); } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList(); MyTable mt = new MyTable("DOC_GROUPDOC"); mt.ColRow = PubFunc.FormDataHT(FormCond); //string type = ddlTYPE.SelectedValue; //mt.ColRow.Add("TYPE", "T"); mt.ColRow.Add("SUBNUM", newDict.Count); mt.ColRow.Add("LRY", UserAction.UserID); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DOC_GROUPCOM"); //先删除单据信息在插入 cmdList.Add(new CommandInfo("DELETE DOC_GROUPDOC WHERE GROUPID='" + hfdGROUPID.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("DELETE DOC_GROUPCOM WHERE GROUPID='" + hfdGROUPID.Text + "'", null)); //删除单据明细 cmdList.AddRange(mt.InsertCommand()); for (int i = 0; i < newDict.Count; i++) { int num = Convert.ToInt32(newDict[i]["SL"]); if (num < 1) { Alert.Show("申请数量不能为0!", "警告提醒", MessageBoxIcon.Warning); return; } mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]); mtTypeMx.ColRow.Remove("ROWNO"); mtTypeMx.ColRow.Add("ROWNO", i + 1); mtTypeMx.ColRow.Add("GROUPID", hfdGROUPID.Text); cmdList.Add(mtTypeMx.Insert()); } if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("模板信息保存成功!", "消息提示", MessageBoxIcon.Information); //DataInit(); GridStrategy.DataSource = GridTemplate(""); GridStrategy.DataBind(); } }