protected void txtConfirmQuantity_Blur(object sender, EventArgs e) { try { //FineUIPro.TextBox ctrl = (FineUIPro.TextBox)Grid1.FindControl("txtConfirmQuantity"); //Alert.Show(ctrl.Text); //return; if (Grid1.GetModifiedDict().Count <= 0) { return; } Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); string s = ""; foreach (int rowIndex in modifiedDict.Keys) { s = modifiedDict[rowIndex]["ConfirmQuantity"].ToString(); double d = (double.Parse(Grid1.Rows[rowIndex].Values[7].ToString()) - double.Parse(s)); //Grid1.UpdateCellValue(rowIndex, "ConfirmQuantity", s); Grid1.UpdateCellValue(rowIndex, "RealUsingQuantity", d.ToString()); Grid1.UpdateCellValue(rowIndex, "ConfirmDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Grid1.UpdateCellValue(rowIndex, "IsConfirm", "1"); Grid1.UpdateCellValue(rowIndex, "BarCode", DateTime.Now.ToString("yyyyMMddHHmmssfff")); System.Threading.Thread.Sleep(1); } } catch (Exception ee) { Alert.Show(ee.ToString()); } }
/// <summary> /// 菜品数量和价格变动处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); tm_TabieDishesInfo tabieDishesInfo = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().GetEntity(rowID); if (tabieDishesInfo.DishesType == "2" || tabieDishesInfo.IsFree == "1" || tabieDishesInfo.DishesType == "3") { continue; } //更新菜品总价 decimal Amount = tabieDishesInfo.Moneys; tabieDishesInfo.DishesCount = decimal.Parse(modifiedDict[rowIndex]["DishesCount"].ToString()); tabieDishesInfo.Moneys = tabieDishesInfo.DishesCount * tabieDishesInfo.Price; Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Update(tabieDishesInfo); //根据菜品变动前总价和变动后总价差异更新就餐信息消费金额 tm_TabieUsingInfo tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID); tabieUsingInfo.Moneys += (tabieDishesInfo.Moneys - Amount); tabieUsingInfo.FactPrice += (tabieDishesInfo.Moneys - Amount); Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(tabieUsingInfo); } //绑定餐台点菜信息 BindTabieDishesInfo(); }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); ContractCarPriceSetInfo objInfo = Core.Container.Instance.Resolve <IServiceContractCarPriceSetInfo>().GetEntity(rowID); if (modifiedDict[rowIndex].Keys.Contains("TonPayPrice")) { objInfo.TonPayPrice = Convert.ToDecimal(modifiedDict[rowIndex]["TonPayPrice"]); } if (modifiedDict[rowIndex].Keys.Contains("CarPayPrice")) { objInfo.CarPayPrice = Convert.ToDecimal(modifiedDict[rowIndex]["CarPayPrice"]); } if (modifiedDict[rowIndex].Keys.Contains("MinTon")) { objInfo.MinTon = Convert.ToDecimal(modifiedDict[rowIndex]["MinTon"]); } Core.Container.Instance.Resolve <IServiceContractCarPriceSetInfo>().Update(objInfo); } BindGrid(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); string sqlCmd = ""; if (modifiedDict.Count == Grid1.Rows.Count) { foreach (int rowIndex in modifiedDict.Keys) { int itemId = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); sqlCmd = "update OA_OfficeSupply_applyItem set actualCounts='" + Convert.ToDecimal(Grid1.Rows[rowIndex].Values[3]) + "' where id='" + itemId + "'"; SqlSel.ExeSql(sqlCmd); } sqlCmd = "update OA_OfficeSupply_Main set adminRegister='1' where id='" + label_tabId.Text + "'"; SqlSel.ExeSql(sqlCmd); Alert.Show("已登记!"); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } else { Alert.ShowInTop("请先登记领用数量!"); return; } } catch (Exception ex) { Alert.ShowInTop(ex.Message); } }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { // 当前选中的单元格 string[] selectedCell = Grid1.SelectedCell; Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); DataRow row = FindRowByID(rowID); UpdateDataRow(modifiedDict[rowIndex], row); } // 数据绑定时,会清空选中的行和选中的单元格 BindGrid(); labResult.Text = String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented)); if (selectedCell != null) { // 重新选中之前的单元格 PageContext.RegisterStartupScript(String.Format("F('{0}').f_selectCell('{1}','{2}');", Grid1.ClientID, selectedCell[0], selectedCell[1])); } }
protected void btn_save_Click(object sender, EventArgs e) { try { string sqlCmd = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); sqlCmd = "update [SFYOrderTab] set CONTACT_NAME='" + Grid1.Rows[rowIndex].Values[4].ToString() + "',"; sqlCmd += "PHONE_NUMBER='" + Grid1.Rows[rowIndex].Values[5].ToString() + "',ADDRESS='" + Grid1.Rows[rowIndex].Values[6].ToString() + "'"; sqlCmd += " where [SOId]=" + rowID; SqlSel_Pro.ExeSql(sqlCmd); } Alert.Show("已保存"); //刷新结果集 //tgb_PO_TriggerClick(sender, e); reBound(); } catch (Exception ex) { Alert.Show(ex.ToString()); return; } }
protected void btnClientProvider_Click(object sender, EventArgs e) { try { if (Grid1.GetModifiedDict().Count > 0) { Alert.Show("请先保存数据再生成计划"); return; } if (Grid1.SelectedRowIndex == -1) { Alert.Show("请先选择数据"); return; } if (!dpPlanFinish.SelectedDate.HasValue) { Alert.Show("计划完成日期不能为空"); return; } if (SaveClientProviderPlan()) { Alert.Show("保存成功"); dpPlanFinish.SelectedDate = null; } else { Alert.Show("保存失败"); } } catch (Exception ee) { Alert.Show(ee.ToString()); } }
/// <summary> /// 主材单价及发货数量编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { //根据绑定列的记录编号,获取发货物品信息和物品基本信息 int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); ContractOrderDetail objInfo = Core.Container.Instance.Resolve <IServiceContractOrderDetail>().GetEntity(rowID); objInfo.GoodsInfo = Core.Container.Instance.Resolve <IServiceEquipmentInfo>().GetEntity(objInfo.GoodsID); //修改发货数量 if (modifiedDict[rowIndex].Keys.Contains("FixGoodsNumber")) { objInfo.GoodsNumber = objInfo.FormerlyGoodsNumber + Convert.ToDecimal(modifiedDict[rowIndex]["FixGoodsNumber"]); objInfo.FixGoodsNumber = Convert.ToDecimal(modifiedDict[rowIndex]["FixGoodsNumber"]); objInfo.NotOffsetNumber = objInfo.FormerlyGoodsNumber + Convert.ToDecimal(modifiedDict[rowIndex]["FixGoodsNumber"]); } //计算并更新计价数量及重量 if (objInfo.PayUnit == 1) { //按计价单位计价,计价数量=商品规格*发货数量 // objInfo.GoodCalcPriceNumber = objInfo.GoodsInfo.Standard * objInfo.GoodsNumber; } else { //按出库数量计价,计价数量=发货数量 objInfo.GoodCalcPriceNumber = objInfo.GoodsNumber; } //更新订单明细 Core.Container.Instance.Resolve <IServiceContractOrderDetail>().Update(objInfo); } //重新加载订单发货信息 BindOrderDetail(); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (Grid1.GetModifiedData().Count == 0 && Grid1.GetNewAddedList().Count == 0) { Alert.Show("表格数据没有变化!"); return; } ArrayList al = new ArrayList(); string sql = "", s = ""; // 新增数据 List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); for (int i = 0; i < newAddedList.Count; i++) { sql = "insert into rlitems(itemno,itemname,Spec,Material,Price,SupplierId,UnitWeight,ProcessCost,ProcessCostType,SurfaceDeal,BaseNum,Sclass,WorkShop,MainFrom,StoreHouse,ProUsingQuantity,ZongCheng) values('" + newAddedList[i]["ItemNo"].ToString() + "','" + newAddedList[i]["ItemName"].ToString() + "','" + newAddedList[i]["Spec"].ToString() + "','" + newAddedList[i]["Material"].ToString() + "'," + newAddedList[i]["Price"].ToString() + "," + newAddedList[i]["SupplierId"].ToString() + "," + newAddedList[i]["UnitWeight"].ToString() + "," + newAddedList[i]["ProcessCost"].ToString() + ",'" + newAddedList[i]["ProcessCostType"].ToString() + "','" + newAddedList[i]["SurfaceDeal"].ToString() + "'," + newAddedList[i]["BaseNum"].ToString() + ",'" + newAddedList[i]["Sclass"].ToString() + "','" + newAddedList[i]["WorkShop"].ToString() + "','" + newAddedList[i]["MainFrom"].ToString() + "','" + newAddedList[i]["StoreHouse"].ToString() + "'," + newAddedList[i]["ProUsingQuantity"].ToString() + ",'" + newAddedList[i]["ZongCheng"].ToString() + "')"; log.Info("sql add item:" + sql); al.Add(sql); } //Alert.Show(s); //return; //s = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); SQLHelper.DbHelperSQL.SetConnectionString(""); foreach (int rowIndex in modifiedDict.Keys) { sql = "update rlitems set "; for (int i = 0; i < Grid1.Columns.Count; i++) { if (modifiedDict[rowIndex].ContainsKey(Grid1.Columns[i].ColumnID)) { sql += Grid1.Columns[i].ColumnID + "='" + modifiedDict[rowIndex][Grid1.Columns[i].ColumnID].ToString() + "',"; } } sql = sql.TrimEnd(new char[] { ',' }); sql += " where sn=" + Grid1.DataKeys[rowIndex][0]; s += sql + "------"; al.Add(sql); } SQLHelper.DbHelperSQL.SetConnectionString(""); if (SQLHelper.DbHelperSQL.ExecuteSqlTran(al)) { Alert.Show("保存成功"); BindGrid(); } else { Alert.Show("保存失败"); } } catch (Exception ee) { Alert.Show(ee.Message); } }
protected void Button2_Click(object sender, EventArgs e) { Dictionary <int, Dictionary <string, string> > modifiedDict = Grid1.GetModifiedDict(); for (int i = 0, count = Grid1.Rows.Count; i < count; i++) { if (modifiedDict.ContainsKey(i)) { Dictionary <string, string> rowDict = modifiedDict[i]; // 更新数据源 DataTable table = GetSourceData(); DataRow rowData = table.Rows[i]; // 姓名 if (rowDict.ContainsKey("Name")) { rowData["Name"] = rowDict["Name"]; } // 性别 if (rowDict.ContainsKey("Gender")) { rowData["Gender"] = Convert.ToInt32(rowDict["Gender"]); } // 入学年份 if (rowDict.ContainsKey("EntranceYear")) { rowData["EntranceYear"] = rowDict["EntranceYear"]; } // 入学日期 if (rowDict.ContainsKey("EntranceDate")) { rowData["EntranceDate"] = DateTime.Parse(rowDict["EntranceDate"]).ToString("yyyy-MM-dd"); } // 是否在校 if (rowDict.ContainsKey("AtSchool")) { rowData["AtSchool"] = Convert.ToBoolean(rowDict["AtSchool"]); } // 所学专业 if (rowDict.ContainsKey("Major")) { rowData["Major"] = rowDict["Major"]; } } } labResult.Text = "用户修改的数据:" + Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.None); BindGrid(); Alert.Show("数据保存成功!(表格数据已重新绑定)"); }
/// <summary> /// 主材单价及发货数量编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { //根据绑定列的记录编号,获取发货物品信息和物品基本信息 int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); ContractInfo contractInfo = Core.Container.Instance.Resolve <IServiceContractInfo>().GetEntity(rowID); //修改高度 if (modifiedDict[rowIndex].Keys.Contains("DoorAmount")) { contractInfo.DoorAmount = Convert.ToDecimal(modifiedDict[rowIndex]["DoorAmount"]); } //修改宽度 if (modifiedDict[rowIndex].Keys.Contains("CabinetAmount")) { contractInfo.CabinetAmount = Convert.ToDecimal(modifiedDict[rowIndex]["CabinetAmount"]); } //修改厚度 if (modifiedDict[rowIndex].Keys.Contains("CabinetCost")) { contractInfo.CabinetCost = Convert.ToDecimal(modifiedDict[rowIndex]["CabinetCost"]); } //修改五金费用 if (modifiedDict[rowIndex].Keys.Contains("DoorCost")) { contractInfo.DoorCost = Convert.ToDecimal(modifiedDict[rowIndex]["DoorCost"]); } //修改超标加价 if (modifiedDict[rowIndex].Keys.Contains("SendCost")) { contractInfo.SendCost = Convert.ToDecimal(modifiedDict[rowIndex]["SendCost"]); } //修改标准单价 if (modifiedDict[rowIndex].Keys.Contains("HandWareCost")) { contractInfo.HandWareCost = Convert.ToDecimal(modifiedDict[rowIndex]["HandWareCost"]); } //修改最终单价 if (modifiedDict[rowIndex].Keys.Contains("AfterSaleCost")) { contractInfo.AfterSaleCost = Convert.ToDecimal(modifiedDict[rowIndex]["AfterSaleCost"]); } //计算商品总价 contractInfo.TotalAmount = contractInfo.DoorAmount + contractInfo.CabinetAmount; //更新订单明细 Core.Container.Instance.Resolve <IServiceContractInfo>().Update(contractInfo); } BindGrid(); }
protected void Button2_Click(object sender, EventArgs e) { // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); DataRow row = FindRowByID(rowID); UpdateDataRow(modifiedDict[rowIndex], row); } // 删除现有数据 List <int> deletedRows = Grid1.GetDeletedList(); foreach (int rowIndex in deletedRows) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); DeleteRowByID(rowID); } // 新增数据 List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); DataTable table = GetSourceData(); if (AppendToEnd) { for (int i = 0; i < newAddedList.Count; i++) { DataRow rowData = CreateNewData(table, newAddedList[i]); table.Rows.Add(rowData); } } else { for (int i = newAddedList.Count - 1; i >= 0; i--) { DataRow rowData = CreateNewData(table, newAddedList[i]); table.Rows.InsertAt(rowData, 0); } } labResult.Text = String.Format("修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented)); BindGrid(); ShowNotify("数据保存成功!(表格数据已重新绑定)"); }
protected void btn_save_Click(object sender, EventArgs e) { try { string curUser = GetUser(); string sqlCmd = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { if (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString())) { Alert.ShowInTop("商品编码不可为空!"); return; } int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); sqlCmd = "update goodsList set goodsNo='" + Grid1.Rows[rowIndex].Values[0].ToString() + "',"; sqlCmd += "[goodsName]='" + Grid1.Rows[rowIndex].Values[1].ToString() + "',"; sqlCmd += "[specification]='" + Grid1.Rows[rowIndex].Values[2].ToString().Trim() + "',"; sqlCmd += "enabled='" + Convert.ToBoolean(Grid1.Rows[rowIndex].Values[3]) + "',"; sqlCmd += "[createDte]='" + DateTime.Now + "',[createUser]='" + curUser + "' "; sqlCmd += "where id=" + rowID; SqlSel_Pro.ExeSql(sqlCmd); } // 新增数据 List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); for (int i = 0; i < newAddedList.Count; i++) { //DataRow rowData = CreateNewData(table, newAddedList[i]); //table.Rows.Add(rowData); if (string.IsNullOrEmpty(newAddedList[i]["goodsNo"].ToString())) { Alert.ShowInTop("商品编码不可为空!"); return; } sqlCmd = "insert into goodsList (goodsNo,goodsName,specification,enabled,createDte,createUser) values "; sqlCmd += "('" + newAddedList[i]["goodsNo"].ToString().Trim() + "','" + newAddedList[i]["goodsName"].ToString() + "','" + newAddedList[i]["specification"].ToString().Trim() + "',"; sqlCmd += "'" + Convert.ToBoolean(newAddedList[i]["enabled"]) + "','" + DateTime.Now + "','" + curUser + "')"; SqlSel_Pro.ExeSql(sqlCmd); } //表格数据重新绑定 bindGrid("ALL"); Alert.Show("保存成功!"); } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }
protected void btn_save_Click(object sender, EventArgs e) { try { string sqlCmd = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { if (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString())) { Alert.ShowInTop("资产名称不可为空!"); return; } int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); sqlCmd = "update OA_Property_Register set [propertyName]='" + Grid1.Rows[rowIndex].Values[0].ToString().Trim() + "',"; sqlCmd += "propertyNo='" + Grid1.Rows[rowIndex].Values[1].ToString().Trim() + "',"; sqlCmd += "BuyDate='" + Convert.ToDateTime(Grid1.Rows[rowIndex].Values[2]) + "',UseStatus='" + Convert.ToInt32(Grid1.Rows[rowIndex].Values[3]) + "',"; sqlCmd += "propertyType='" + Convert.ToInt32(Grid1.Rows[rowIndex].Values[4]) + "' "; sqlCmd += "where id=" + rowID; SqlSel.ExeSql(sqlCmd); } // 新增数据 List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); for (int i = 0; i < newAddedList.Count; i++) { //DataRow rowData = CreateNewData(table, newAddedList[i]); //table.Rows.Add(rowData); if (string.IsNullOrEmpty(newAddedList[i]["propertyName"].ToString())) { Alert.ShowInTop("资产名称不可为空!"); return; } sqlCmd = "insert into OA_Property_Register (propertyName,propertyNo,BuyDate,UseStatus,propertyType) values "; sqlCmd += "('" + newAddedList[i]["propertyName"].ToString().Trim() + "','" + newAddedList[i]["propertyNo"].ToString() + "','" + Convert.ToDateTime(newAddedList[i]["BuyDate"]) + "',"; sqlCmd += "'" + Convert.ToInt32(newAddedList[i]["UseStatus"]) + "','" + Convert.ToInt32(newAddedList[i]["propertyType"]) + "')"; Alert.Show(sqlCmd); SqlSel.ExeSql(sqlCmd); } //表格数据重新绑定 bindGrid(); Alert.Show("保存成功!"); } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); tm_SetMealDetail objInfo = Core.Container.Instance.Resolve <IServiceSetMealDetail>().GetEntity(rowID); objInfo.DishCount = Int32.Parse(modifiedDict[rowIndex]["DishCount"].ToString()); objInfo.TotalPrice = objInfo.DishCount * objInfo.Price; Core.Container.Instance.Resolve <IServiceSetMealDetail>().Update(objInfo); } BindGrid(); }
private bool save() { string sql = "select max(RIGHT(CPORDERNO,LEN(CPORDERNO)-2)) from CPOrderHeader where InputeDate>=CONVERT(varchar(100), GETDATE(), 23)"; SQLHelper.DbHelperSQL.SetConnectionString(""); string CPORDERNO = SQLHelper.DbHelperSQL.GetSingle(sql, 30).ToString(); if (string.IsNullOrEmpty(CPORDERNO)) { sql = "Select CONVERT(varchar(100), GETDATE(), 112)"; CPORDERNO = SQLHelper.DbHelperSQL.GetSingle(sql, 30).ToString() + "0001"; } else { CPORDERNO = (Int64.Parse(CPORDERNO) + 1).ToString(); } ArrayList al = new ArrayList(); int row = 0; //,Properties ,PDate ,Purchaser ,Dept ,Project ,Provider ,ProviderName Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in Grid1.SelectedRowIndexArray) { if (row == 0) { sql = "INSERT INTO CPOrderHeader (CPOrderNo,CPDate,Provider,ProviderID,JBRID,JBRName,ContactMan,Tel,Fax,JHDate,JHPlace,JSFS,ZZSFP,ProviderConfirm,ApproveID,CheckerID,MakerID,Inputer,InputeDate,CPPlanNo,SaleOrderNo) values('CP" + CPORDERNO + "','" + XDDate.Text + "','" + Grid1.Rows[rowIndex].Values[2].ToString() + "','" + Grid1.Rows[rowIndex].Values[10].ToString() + "','" + User.Identity.Name + "','" + GetChineseName() + "','" + txtContactMan.Text + "','" + txtTel.Text + "','" + txtFax.Text + "','" + JHdate.Text + "','锐麟厂','月结',0,'','','','" + User.Identity.Name + "','" + User.Identity.Name + "',getdate(),'" + Grid1.Rows[rowIndex].Values[3].ToString() + "','" + Grid1.Rows[rowIndex].Values[1].ToString() + "')"; al.Add(sql); row = 1; } System.Threading.Thread.Sleep(1); sql = "INSERT INTO CPOrderDetail (FSN,CPOrderNo,CPPlanNo,SaleOrderNo,ProNo,ProName,ItemNo,ItemName,Spec,Quantity,Unit,Remark,Inputer,InputeDate,BomSN,BarCode) select (select max(sn) from CPOrderHeader where CPOrderNo='CP" + CPORDERNO + "'),'CP" + CPORDERNO + "',CPPlanNo,SaleOrderNo,prono,ProName ,ItemNo ,ItemName ,Spec ,Quantity,Unit,'','" + User.Identity.Name + "',getdate(),BomSN,'" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "' from CPlan where sn=" + Grid1.DataKeys[rowIndex][0].ToString(); al.Add(sql); log.Info("sqlpur::::" + sql); sql = "update CPlan set State=1 where sn=" + Grid1.DataKeys[rowIndex][0].ToString(); al.Add(sql); log.Info("sqlpur::::" + sql); //sql = "update AllItem set SupplierId=(select sn from Provider where name='" + modifiedDict[rowIndex]["Provider"].ToString() + "') where itemno='" + Grid1.Rows[rowIndex].Values[6].ToString() + "'"; //al.Add(sql); //log.Info("sqlAllItem::::" + sql); } if (al.Count > 0) { return(SQLHelper.DbHelperSQL.ExecuteSqlTran(al)); } else { return(false); } }
protected void btn_save_Click(object sender, EventArgs e) { try { string sqlCmd = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { if (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString())) { Alert.ShowInTop("角色名不可为空!"); return; } int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); sqlCmd = "update OA_Sys_Role set roleName='" + Grid1.Rows[rowIndex].Values[0].ToString() + "',"; sqlCmd += "roleDesc='" + Grid1.Rows[rowIndex].Values[1].ToString() + "',"; sqlCmd += "UseStatus='" + Convert.ToBoolean(Grid1.Rows[rowIndex].Values[2]) + "',createDate='" + DateTime.Now + "' "; sqlCmd += "where id=" + rowID; SqlSel.ExeSql(sqlCmd); } // 新增数据 List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); for (int i = 0; i < newAddedList.Count; i++) { //DataRow rowData = CreateNewData(table, newAddedList[i]); //table.Rows.Add(rowData); if (string.IsNullOrEmpty(newAddedList[i]["roleName"].ToString())) { Alert.ShowInTop("角色名不可为空!"); return; } sqlCmd = "insert into OA_Sys_Role (roleName,roleDesc,UseStatus,createDate) values "; sqlCmd += "('" + newAddedList[i]["roleName"].ToString().Trim() + "','" + newAddedList[i]["roleDesc"].ToString() + "',"; sqlCmd += "'" + Convert.ToBoolean(newAddedList[i]["UseStatus"]) + "','" + DateTime.Now + "')"; SqlSel.ExeSql(sqlCmd); } //表格数据重新绑定 bindGrid(); Alert.Show("保存成功!"); } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, string> > modifiedDict = Grid1.GetModifiedDict(); int rowID = Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]); DataRow row = FindRowByID(rowID); UpdateDataRow(modifiedDict[e.RowIndex], row); BindGrid(); labResult.Text = "用户修改的数据:" + Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.None); Alert.Show("数据保存成功!(表格数据已重新绑定)"); }
protected void btn_save_Click(object sender, EventArgs e) { try { string sqlCmd = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { if (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString())) { Alert.ShowInTop("名称不可为空!"); return; } int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); sqlCmd = "update OA_DocMgmt_DocType set [type_name]='" + Grid1.Rows[rowIndex].Values[0].ToString() + "',"; sqlCmd += "[fl_desc]='" + Grid1.Rows[rowIndex].Values[1].ToString() + "' "; sqlCmd += "where id=" + rowID; SqlSel.ExeSql(sqlCmd); } // 新增数据 List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList(); for (int i = 0; i < newAddedList.Count; i++) { //DataRow rowData = CreateNewData(table, newAddedList[i]); //table.Rows.Add(rowData); if (string.IsNullOrEmpty(newAddedList[i]["type_name"].ToString())) { Alert.ShowInTop("名称不可为空!"); return; } sqlCmd = "insert into OA_DocMgmt_DocType (type_name,pid,fl_desc,stat) values "; sqlCmd += "('" + newAddedList[i]["type_name"].ToString().Trim() + "','0','" + newAddedList[i]["fl_desc"].ToString() + "','1')"; SqlSel.ExeSql(sqlCmd); } //表格数据重新绑定 bindGrid(); Alert.Show("保存成功!"); } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }
/// <summary> /// /// 提交添加 /// </summary> private bool SubmintAdd() { try { LHContract iscontract = ContractServie.FirstOrDefault(p => p.FOrderCode == hiddevalue.Text); if (iscontract != null) { Alert.Show("该数据已经存在,不能重复保存"); } using (TransactionScope socp = new TransactionScope()) { LHContract contract = new LHContract(); contract.FOrderCode = hiddevalue.Text; contract.FContractCode = txtFContractCode.Text.Trim(); contract.FContractDate = dpFContractDate.SelectedDate; contract.FContractName = txtFContractName.Text.Trim(); if (!string.IsNullOrEmpty(ddlFAccType.SelectedValue)) { contract.FAccType = ddlFAccType.SelectedValue; } if (!string.IsNullOrEmpty(ddlFBillType.SelectedValue)) { contract.FBillType = ddlFBillType.SelectedValue; } contract.FConacter = ddlFCtroler.SelectedValue; contract.FBeginDate = dpFBeginDate.SelectedDate; contract.FEndDate = dpFEndDate.SelectedDate; contract.FCustomer = this.txtFCustomer.Text.Trim(); contract.FContext = txtFContext.Text.Trim(); contract.FConacter = txtFConacter.Text.Trim(); contract.FTel = txtFTel.Text.Trim(); contract.FCreatedby = CurrentUser.AccountJobNumber; contract.FCreatedon = DateTime.Now; contract.FDeleteflag = 0; contract.FCompanyId = CurrentUser.AccountComId; ContractServie.Add(contract); var dictModified = Grid1.GetModifiedDict(); ModifiedGrid(); ; socp.Complete(); return(true); } } catch { return(false); } }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); tm_DishesBatching objInfo = Core.Container.Instance.Resolve <IServiceDishesBatching>().GetEntity(rowID); objInfo.UsingCount = Convert.ToDecimal(modifiedDict[rowIndex]["UsingCount"]); objInfo.CostPrice = objInfo.UsingUnitPrice * objInfo.UsingCount; Core.Container.Instance.Resolve <IServiceDishesBatching>().Update(objInfo); } BindGrid(); }
private void ModifiedGrid() { //编辑行事件 var dictModified = Grid1.GetModifiedDict(); //if (Grid1 != null && Grid1.Rows.Count > 0) //{ // for (int i = 0; i < Grid1.Rows.Count; i++) // { // int datakey = Convert.ToInt32(Grid1.Rows[i].DataKeys[0].ToString()); // var details = ContractDetailstServie.Where(p => p.FID == datakey).FirstOrDefault(); // details.FPrice = Convert.ToDecimal(((TextBox)Grid1.Rows[i].FindControl("tbxFPrice")).Text); // ContractDetailstServie.SaveChanges(); // } //} foreach (var rowKey in dictModified.Keys) { int datakey = Convert.ToInt32(Grid1.DataKeys[rowKey][0].ToString()); var sKeys = new StringBuilder(); var sValues = new StringBuilder(); foreach (var key in dictModified[rowKey].Keys) { sKeys.AppendFormat("{0},", key); } foreach (var dictValue in dictModified[rowKey].Values) { sValues.AppendFormat("{0},", dictValue); } var keys = sKeys.ToString().Split(','); var values = sValues.ToString().Split(','); var details = ContractDetailstServie.Where(p => p.FId == datakey).FirstOrDefault(); for (int i = 0; i < keys.Count(); i++) { var key = keys[i]; var value = values[i]; if (key.Equals("FPrice")) { details.FPrice = Convert.ToDecimal(value); } } ContractDetailstServie.SaveChanges(); } }
protected void Button2_Click(object sender, EventArgs e) { Dictionary <int, Dictionary <string, string> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); DataRow row = FindRowByID(rowID); UpdateDataRow(modifiedDict[rowIndex], row); } BindGrid(); labResult.Text = "用户修改的数据:" + Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.None); Alert.Show("数据保存成功!(表格数据已重新绑定)"); }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); DataRow row = FindRowByID(rowID); UpdateDataRow(modifiedDict[rowIndex], row); } BindGrid(); labResult.Text = String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented)); Alert.Show("数据保存成功!(表格数据已重新绑定)"); }
protected void btnSaveData_Click(object sender, EventArgs e) { try { if (Grid1.GetModifiedDict().Count == 0) { Alert.Show("没有要保存的数据"); return; } ArrayList al = new ArrayList(); string sql = ""; // 修改的现有数据 Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); SQLHelper.DbHelperSQL.SetConnectionString(""); foreach (int rowIndex in modifiedDict.Keys) { sql = "update PurchasePlan set "; for (int i = 0; i < Grid1.Columns.Count; i++) { if (modifiedDict[rowIndex].ContainsKey(Grid1.Columns[i].ColumnID)) { sql += Grid1.Columns[i].ColumnID + "='" + modifiedDict[rowIndex][Grid1.Columns[i].ColumnID].ToString() + "',"; } } sql = sql.TrimEnd(new char[] { ',' }); sql += " where sn=" + Grid1.DataKeys[rowIndex][0]; al.Add(sql); log.Info(sql); } if (al.Count > 0 && SQLHelper.DbHelperSQL.ExecuteSqlTran(al)) { Alert.Show("保存成功"); BindGrid(); } else { Alert.Show("保存失败"); } } catch (Exception ee) { Alert.Show(ee.Message); } }
/// <summary> /// 主材发货数量编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { //根据绑定列的记录编号,获取发货物品信息和物品基本信息 int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); ContractOrderDetail objInfo = Core.Container.Instance.Resolve <IServiceContractOrderDetail>().GetEntity(rowID); objInfo.GoodsInfo = Core.Container.Instance.Resolve <IServiceEquipmentInfo>().GetEntity(objInfo.GoodsID); //修改发货数量 if (modifiedDict[rowIndex].Keys.Contains("GoodsNumber")) { objInfo.GoodsNumber = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsNumber"]); //最终发货数量 objInfo.FormerlyGoodsNumber = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsNumber"]); //原始发货数量 objInfo.NotOffsetNumber = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsNumber"]); //商品待还数量 //更新辅材信息 UpdateSecondaryDetail(objInfo); } //计算并更新计价数量及重量 if (objInfo.PayUnit == 1) { //按计价单位计价,计价数量=商品规格*发货数量 // objInfo.GoodCalcPriceNumber = objInfo.GoodsInfo.Standard * objInfo.GoodsNumber; } else { //按出库数量计价,计价数量=发货数量 objInfo.GoodCalcPriceNumber = objInfo.GoodsNumber; } //计算客户、员工和司机的发货商品重量 //objInfo.GoodsCustomerWeight = objInfo.GoodsInfo.Standard * objInfo.GoodsNumber / objInfo.GoodsInfo.CustomerUnit; //objInfo.GoodsDriverWeight = objInfo.GoodsInfo.Standard * objInfo.GoodsNumber / objInfo.GoodsInfo.DriverUnit; //objInfo.GoodsStaffWeight = objInfo.GoodsInfo.Standard * objInfo.GoodsNumber / objInfo.GoodsInfo.StaffUnit; ////更新订单明细 Core.Container.Instance.Resolve <IServiceContractOrderDetail>().Update(objInfo); //更新费用信息 new ContractOrderBase().CalcOrderCost(OrderNO); //CalcOrderCost(); } //重新加载订单发货信息 BindOrderDetail(); }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); PriceSetGoodsInfo objInfo = Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().GetEntity(rowID); if (modifiedDict[rowIndex].Keys.Contains("DailyRents")) { objInfo.DailyRents = Convert.ToDecimal(modifiedDict[rowIndex]["DailyRents"]); } if (modifiedDict[rowIndex].Keys.Contains("UnitPrice")) { objInfo.UnitPrice = Convert.ToDecimal(modifiedDict[rowIndex]["UnitPrice"]); } if (modifiedDict[rowIndex].Keys.Contains("FixPrice")) { objInfo.FixPrice = Convert.ToDecimal(modifiedDict[rowIndex]["FixPrice"]); } if (modifiedDict[rowIndex].Keys.Contains("MinRentingDays")) { objInfo.MinRentingDays = Convert.ToInt32(modifiedDict[rowIndex]["MinRentingDays"]); } if (modifiedDict[rowIndex].Keys.Contains("CustomerUnit")) { objInfo.CustomerUnit = Convert.ToDecimal(modifiedDict[rowIndex]["CustomerUnit"]); } if (modifiedDict[rowIndex].Keys.Contains("DriverUnit")) { objInfo.DriverUnit = Convert.ToDecimal(modifiedDict[rowIndex]["DriverUnit"]); } if (modifiedDict[rowIndex].Keys.Contains("StaffUnit")) { objInfo.StaffUnit = Convert.ToDecimal(modifiedDict[rowIndex]["StaffUnit"]); } Core.Container.Instance.Resolve <IServicePriceSetGoodsInfo>().Update(objInfo); } BindGrid(); }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { try { using (TransactionScope socp = new TransactionScope()) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); LHContract contract = Contract; contract.FOrderCode = hiddevalue.Text; contract.FContractCode = txtFContractCode.Text.Trim(); contract.FContractDate = dpFContractDate.SelectedDate; contract.FConacter = ddlFCtroler.SelectedValue; if (!string.IsNullOrEmpty(ddlFAccType.SelectedValue)) { contract.FAccType = ddlFAccType.SelectedValue; } if (!string.IsNullOrEmpty(ddlFBillType.SelectedValue)) { contract.FBillType = ddlFBillType.SelectedValue; } contract.FBeginDate = dpFBeginDate.SelectedDate; contract.FEndDate = dpFEndDate.SelectedDate; contract.FCustomer = this.txtFCustomer.Text; contract.FContext = txtFContext.Text.Trim(); contract.FConacter = txtFConacter.Text.Trim(); contract.FTel = txtFTel.Text.Trim(); contract.FUpdateby = CurrentUser.AccountJobNumber; contract.FUpdateon = DateTime.Now; ContractServie.SaveChanges(); ModifiedGrid(); //UpdateDataRow(modifiedDict); socp.Complete(); return(true); } } catch { return(false); } }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); EquipmentAssortInfo objInfo = Core.Container.Instance.Resolve <IServiceEquipmentAssortInfo>().GetEntity(rowID); if (modifiedDict[rowIndex].Keys.Contains("AssortCount")) { objInfo.AssortCount = Convert.ToDecimal(modifiedDict[rowIndex]["AssortCount"]); } if (modifiedDict[rowIndex].Keys.Contains("EquipmentCount")) { objInfo.EquipmentCount = Convert.ToDecimal(modifiedDict[rowIndex]["EquipmentCount"]); } if (modifiedDict[rowIndex].Keys.Contains("IsOutCalcNumber")) { objInfo.IsOutCalcNumber = Convert.ToInt32(modifiedDict[rowIndex]["IsOutCalcNumber"]); } if (modifiedDict[rowIndex].Keys.Contains("IsOutCalcPrice")) { objInfo.IsOutCalcPrice = Convert.ToInt32(modifiedDict[rowIndex]["IsOutCalcPrice"]); } if (modifiedDict[rowIndex].Keys.Contains("IsInCalcNumber")) { objInfo.IsInCalcNumber = Convert.ToInt32(modifiedDict[rowIndex]["IsInCalcNumber"]); } if (modifiedDict[rowIndex].Keys.Contains("IsInCalcPrice")) { objInfo.IsInCalcPrice = Convert.ToInt32(modifiedDict[rowIndex]["IsInCalcPrice"]); } Core.Container.Instance.Resolve <IServiceEquipmentAssortInfo>().Update(objInfo); } BindGrid(); }
protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e) { Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict(); foreach (int rowIndex in modifiedDict.Keys) { int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); ReceiveOrderDetail objInfo = Core.Container.Instance.Resolve <IServiceReceiveOrderDetail>().GetEntity(rowID); if (modifiedDict[rowIndex].Keys.Contains("GoodsUnitPrice")) { objInfo.GoodsUnitPrice = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsUnitPrice"]); } if (modifiedDict[rowIndex].Keys.Contains("GoodsNumber")) { objInfo.GoodsNumber = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsNumber"]); } objInfo.GoodTotalPrice = objInfo.GoodsUnitPrice * objInfo.GoodsNumber; Core.Container.Instance.Resolve <IServiceReceiveOrderDetail>().Update(objInfo); } BindGrid(); }