//服务器端逻辑删除 protected void deleteFromDb(int DbId) { string sqlCmd = "update OA_Bills_costLists set bStatus='0' id=" + DbId; SqlSel.ExeSql(sqlCmd); bindGrid(); }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { try { string sqlCmd = "", parentId = ddl_parentMenu.SelectedValue; int sortIndex = 0; if (ddl_parentMenu.SelectedItem != null) { sortIndex = getSortIndex(parentId); sortIndex += 1; } //新建菜单直接添加 if (string.IsNullOrEmpty(recvId)) { sqlCmd = "insert into OA_Sys_Menu (Title,NavigateUrl,Remark,ParentMenuId,SortIndex,enabled) values "; sqlCmd += "('" + txb_title.Text + "','" + txb_url.Text + "','" + txa_desc.Text + "','" + parentId + "','" + sortIndex + "','1')"; SqlSel.ExeSql(sqlCmd); } else//历史项进行更新 { sqlCmd = "update OA_Sys_Menu set Title='" + txb_title.Text + "',NavigateUrl='" + txb_url.Text + "',"; sqlCmd += "Remark='" + txa_desc.Text + "',ParentMenuId='" + parentId + "' where id='" + recvId + "'"; SqlSel.ExeSql(sqlCmd); } Alert.Show("编辑成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());//关闭并刷新数据 } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }
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 btnSubmit_Click(object sender, EventArgs e) { try { string stepId = getStepId(ddl_flow.SelectedValue); string sqlCmd = "insert into OA_PayMent_Main (reqMan,reqDte,payeeName,projId,FlowId,CurrentStepID,others,isAdvPay,payTotal) values "; sqlCmd += "('" + GetUser() + "','" + DateTime.Now + "','" + txb_payeeName.Text + "','" + ddl_proj.SelectedValue + "','" + ddl_flow.SelectedValue + "','" + stepId + "','" + txa_reason.Text + "','" + rdb_payType.SelectedValue + "','" + numbbox_total.Text + "')"; int exeCount = SqlSel.ExeSql(sqlCmd); if (exeCount > 0) { //取当前单据id sqlCmd = "select max(id) from OA_PayMent_Main"; string formId = SqlSel.GetSqlScale(sqlCmd).ToString(); //插入附件信息表 InsertFiles(formId); Alert.Show("提交成功!"); //表单重置 SimpleForm1.Reset(); Grid1.DataSource = null; Grid1.DataBind(); //推送信息至相关审批人 pushMessage(stepId, "OA_PayMent_Main", formId, "付款申请"); } } catch (Exception ex) { Alert.Show(ex.Message); } }
private void deleteFromDb(int rowID) { string sqlCmd = "update OA_Sys_Menu set enabled=0 where id='" + rowID + "'"; SqlSel.ExeSql(sqlCmd); bindGrid(); }
protected void btn_save_Click(object sender, EventArgs e) { if (passwordIsOk(txb_origPsw.Text)) { if (txb_password.Text == txb_password_confirm.Text) { string pswMd5 = PasswordUtil.CreateDbPassword(txb_password.Text.Trim()); string sqlCmd = "update OA_Sys_EmployeeInfo set password='******' where id=" + GetUser(); SqlSel.ExeSql(sqlCmd); SimpleForm1.Reset(); Alert.Show("密码修改完成!"); } else { Alert.ShowInTop("两次输入的密码不一致!请重新输入。"); return; } } else { Alert.ShowInTop("原密码不匹配!"); return; } }
protected void btn1_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); string ddlsStr = txt_ddls.Value; String[] str = ddlsStr.Split(';'); foreach (string it in str) { if (it == "") { break; } //获取订单流水 int recId = Convert.ToInt32(it); // string sqlCmd = "select * from T_Print_dtl where RecID=" + recId; SqlSel.GetSqlSel(ref dt, sqlCmd); if (dt.Rows.Count > 0) { continue; } else { sqlCmd = "insert into T_Print_dtl (IsPrint,PrintTime,RecID) values (1,'" + DateTime.Now + "'," + recId + ")"; SqlSel.ExeSql(sqlCmd); } } }
//计划下线 protected void btn_offLine_Click(object sender, EventArgs e) { try { if (Grid1.SelectedRowIndexArray.Length < 1) { Alert.Show("没有选中任何行!"); return; } int pId = 0; int[] selections = Grid1.SelectedRowIndexArray; foreach (int rowIndex in selections) { GridRow row = Grid1.Rows[rowIndex]; System.Web.UI.WebControls.Label lineStatus = (System.Web.UI.WebControls.Label)row.FindControl("Label2"); if (lineStatus.Text == "上线") { pId = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]); string sqlCmd = "update PLM_Product_OnLine set OnlineStatus=0,endTime='" + DateTime.Now + "' where id='" + pId + "'"; SqlSel.ExeSql(sqlCmd); } } Alert.Show("已下线!"); bindGrid(RadioButtonList1.SelectedValue, ddl_line.SelectedValue); } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }
public bool Wdgj_SellBack_Confirm(string JsonStr) { bool result = true; List <SellBack_GoodsReg> list = JsonConvert.DeserializeObject <List <SellBack_GoodsReg> >(JsonStr); string sqlCmd = string.Empty; foreach (SellBack_GoodsReg goods in list) { if (goods.RemainSum > 0) { sqlCmd = "insert into ES_WH_SellBackRegister (Operator,RegTime,BillId,recId,DealWith,GoodsType,RegCount) values" + " ('刘雯雯',getdate(),'" + goods.TradeId + "','" + goods.RecId + "'," + "'" + goods.DealWith + "','1','" + goods.RemainSum + "')"; if (SqlSel.ExeSql(sqlCmd) > 0) { continue; } else { result = false; break; } } else { continue; } } return(result); }
//服务器端删除 protected void deleteFromDb(int DbId) { string sqlCmd = "delete from OA_Property_Register where id=" + DbId; SqlSel.ExeSql(sqlCmd); bindGrid(); }
//提交 protected void btnSubmit_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(RadioButtonList_goal.SelectedValue)) { string sqlcmd = "update T_DailyWork set LeaderGrade=" + Convert.ToInt32(RadioButtonList_goal.SelectedValue) + ",LeaderGradeReason='" + TextArea_context.Text + "' where Id=" + tabId + " "; int exeCount = SqlSel.ExeSql(sqlcmd); if (exeCount > 0) { //将审批结果反馈给相关人员 string messageContent = string.Format("工作评分:{0}分\\n领导寄语:{1}", RadioButtonList_goal.SelectedValue, TextArea_context.Text); sqlcmd = "select cellPhone from x_user where name='" + label_hidden.Text + "'"; string targetNum = SqlSel.GetSqlScale(sqlcmd).ToString(); if (!string.IsNullOrEmpty(targetNum)) { WX2HK.ReturnInfo.messagePushByNum(targetNum + ";", string.Format("{0}-工作情况", label_date.Text), "", messageContent, ""); } //Alert.Show("提交成功!"); btnSubmit.Hidden = true; // 关闭本窗体,然后刷新父窗体 PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } } else { Alert.ShowInTop("请打分!"); return; } }
//服务器端删除 protected void deleteFromDb(int DbId) { string sqlCmd = "delete from OA_Sys_Step_Emp where id=" + DbId; SqlSel.ExeSql(sqlCmd); bindGrid3(Grid2.DataKeys[Grid2.SelectedRowIndex][0].ToString()); }
//服务器端删除 protected void deleteFromDb(int DbId) { string sqlCmd = "delete from OA_sys_Duties where id=" + DbId; SqlSel.ExeSql(sqlCmd); bindGrid(); }
//服务器端删除 protected void deleteFromDb(int DbId) { string sqlCmd = "update OA_sys_department set stat=0 where id=" + DbId; SqlSel.ExeSql(sqlCmd); bindGrid(); }
protected void Grid2_RowCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "Delete") { string flowId = Grid1.DataKeys[Grid1.SelectedRowIndex][0].ToString(); //流程id string stepId = Grid2.DataKeys[e.RowIndex][0].ToString(); //步骤id int orderNo = Convert.ToInt32(Grid2.Rows[e.RowIndex].Values[1]); //判断当前步骤是否有正在执行的单据 if (StepExistsInForms(stepId)) { Alert.ShowInTop("当前步骤存在待审批的表单,无法删除!"); return; } else { //删除该步骤 string sqlCmd = "delete from OA_Sys_Flow_Step where id='" + stepId + "'"; SqlSel.ExeSql(sqlCmd); //后面的步骤顺序上移 sqlCmd = "update OA_Sys_Flow_Step set stepOrderNo=(stepOrderNo-1) where flowId='" + flowId + "' and stepOrderNo>'" + orderNo + "'"; SqlSel.ExeSql(sqlCmd); bindGrid2(flowId);//最后重新刷新 } } }
//排产数据的添加 private void infoInsert() { string curUser = GetUser(); if (!string.IsNullOrEmpty(curUser)) { int isTempOrder = 0; if (CkeckBox_enabled.Checked) { isTempOrder = 1; } string ImgURL = label_hidden.Text; string sqlCmd = "insert into [PLM_Product_OnLine] ([LineId],[OrderId],[BuildTime],[OnlineStatus],[OperUser] ,[PlanCount] ,[IsTemp] ,[OrderNo] ,[ItemParm] ,[ItemName],[ItemNo],[RedLineCount],[PreSetCount],[ItemTech])"; sqlCmd += " values ('" + ddl_line.SelectedValue + "','" + Label_sn.Text + "','" + DateTime.Now + "',1,'" + curUser + "','" + numb_planCount.Text + "','" + isTempOrder + "',"; sqlCmd += "'" + txb_workNo.Text + "','" + TextArea_parm.Text + "','" + txb_itemName.Text + "','" + txb_itemNo.Text + "','" + numb_redCount.Text + "','" + numb_preSet.Text + "','" + txb_itemTech.Text + "')"; SqlSel.ExeSql(sqlCmd); sqlCmd = "select max(id) from PLM_Product_OnLine"; int onlineId = Convert.ToInt32(SqlSel.GetSqlScale(sqlCmd)); sqlCmd = "insert into PLM_Product_Image (OnlineId,ImgURL) values "; sqlCmd += "('" + onlineId + "','" + ImgURL + "')"; SqlSel.ExeSql(sqlCmd); //执行关联明细信息的数据插入(单条) string sqlStr = "insert into PLM_Product_Rel (orderid,ProdId,PriLevel,OrderCount) values "; sqlStr += "('" + Label_sn.Text + "','" + onlineId + "',1,'" + numb_redCount.Text + "')"; SqlSel.ExeSql(sqlStr); Alert.ShowInTop("操作成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } }
protected void btn_Invalid_Click(object sender, EventArgs e) { string sqlCmd = ""; int[] selections = Grid3.SelectedRowIndexArray; foreach (int rowIndex in selections) { //获取行index //int rowindex = Grid3.SelectedRowIndexArray[i]; int fileid = Convert.ToInt32(Grid3.DataKeys[rowIndex][0]); string serverFileName = Grid3.Rows[rowIndex].Values[5].ToString();//服务器文件名 sqlCmd = "delete from OA_DocMgmt_DocList WHERE ID=" + fileid; int exeCount = SqlSel.ExeSql(sqlCmd); if (exeCount == 0) { Alert.ShowInTop("出错了!"); return; } else { string filePath = "~/upload/" + serverFileName; if (File.Exists(Server.MapPath(filePath))) { //如果文件存在则删除 File.Delete(Server.MapPath(filePath)); } } } Alert.ShowInTop("已删除!"); bindGrid(ddl_proj.SelectedValue); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { //是否增加审批流程 if (string.IsNullOrEmpty(txb_flowId.Text)) { string sqlCmd = "update OA_UseStamp_Main set adminRegister='1' where id='" + label_tabId.Text + "'"; SqlSel.ExeSql(sqlCmd); Alert.Show("已盖章!"); } else { string stepId = getStepId(txb_flowId.Text);//获取步骤id string sqlCmd = "update OA_UseStamp_Main set flowId='" + txb_flowId.Text + "',CurrentStepID='" + stepId + "' where id='" + label_tabId.Text + "'"; int exeCount = SqlSel.ExeSql(sqlCmd); if (exeCount > 0) { //推送信息至相关审批人 pushMessage(stepId, "OA_UseStamp_Main", label_tabId.Text, "用印申请"); Alert.Show("已提交审批!"); } } PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } catch (Exception ex) { Alert.ShowInTop(ex.Message); } }
protected void btn_sub_Click(object sender, EventArgs e) { try { if (Grid1.Rows.Count > 0) { for (int i = 0; i < Grid1.Rows.Count; i++) { GridRow grow = Grid1.Rows[i]; if (string.IsNullOrEmpty(((System.Web.UI.WebControls.TextBox)grow.FindControl("tbxWorkDtl")).Text)) { Alert.ShowInTop("工作内容不可为空!"); return; } } string sqlCmd = ""; sqlCmd = "insert into T_DailyWork (ReqDte,WorkDte,WorkNo,SelfGrade,Stat) values"; sqlCmd += "('" + DateTime.Now + "','" + label_date.Text + "','" + curUser + "'," + Convert.ToInt32(RadioButtonList_goal.SelectedValue) + ",11)"; SqlSel.ExeSql(sqlCmd); sqlCmd = "select max(Id) from T_DailyWork where workno='" + curUser + "'"; int maxId = Convert.ToInt32(SqlSel.GetSqlScale(sqlCmd)); for (int i = 0; i < Grid1.Rows.Count; i++) { GridRow grow = Grid1.Rows[i]; sqlCmd = "insert into T_Work_Detail_Record"; sqlCmd += "(MainID,WorkDetail,WorkProcess,Mark) values"; sqlCmd += "(" + maxId + ",'" + ((System.Web.UI.WebControls.TextBox)grow.FindControl("tbxWorkDtl")).Text + "',100,'" + Grid1.Rows[i].Values[0].ToString() + "')"; SqlSel.ExeSql(sqlCmd); } //推送相关提交信息 sqlCmd = "select CellPhone from x_user where name=(select rz_parentid from view_rs_employeeinfo where gh_id='" + curUser + "')"; string targetNum = SqlSel.GetSqlScale(sqlCmd).ToString(); string messageContent = string.Format("来自{0}的工作汇报", label_name.Text); if (!string.IsNullOrEmpty(targetNum)) { string url = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc1c3336a5eeb57ea&redirect_uri=http%3a%2f%2foa.mlily.com%3a30020%2fdailyWork%2fdailyWork_leaderView.aspx?mainId={0}&response_type=code&scope=SCOPE&state=STATE#wechat_redirect", maxId); WX2HK.ReturnInfo.messagePushByNum(targetNum + ";", string.Format("{0}-工作汇报", label_date.Text), url, messageContent, ""); } Alert.Show("提交成功!"); PageContext.RegisterStartupScript(SimpleForm1.GetResetReference()); Grid1.Reset(); btnSubmit.Hidden = true; } else { Alert.ShowInTop("请填写相关工作内容后再提交!"); return; } } catch (Exception ex) { Alert.ShowInTop(ex.Message); } }
protected void btn_veto_Click(object sender, EventArgs e) { string sqlCmd = "update OA_UseStamp_Main set adminRegister='-1' where id='" + label_tabId.Text + "'"; SqlSel.ExeSql(sqlCmd); Alert.Show("已取消!"); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(numbbox_days.Text) & string.IsNullOrEmpty(numbbox_hours.Text)) { Alert.ShowInTop("天数和小时至少填一项。"); return; } //if (string.IsNullOrEmpty(hidden_field.Value)) //{ // Alert.Show("请先添加相应的文件,若已添加则确认可用!"); // return; //} decimal days = 0; decimal hours = 0; if (!string.IsNullOrEmpty(numbbox_days.Text)) { days = Convert.ToDecimal(numbbox_days.Text); } if (!string.IsNullOrEmpty(numbbox_hours.Text)) { hours = Convert.ToDecimal(numbbox_hours.Text); } string stepId = getStepId(ddl_flow.SelectedValue);//获取步骤id string sqlCmd = "insert into OA_Leave_Main ([reqMan],[reqDte],[strTime],[endTime],[lastDays],[leaveReason],[FlowId],[CurrentStepID],[workReplacer],[lastHours]) values "; sqlCmd += "('" + curUserId + "','" + DateTime.Now + "','" + DatePicker1.Text + " " + TimePicker1.Text + "','" + DatePicker2.Text + " " + TimePicker2.Text + "','" + days + "',"; sqlCmd += "'" + TextArea_desc.Text.Trim() + "','" + ddl_flow.SelectedValue + "','" + stepId + "','" + txb_replacer.Text.Trim() + "','" + hours + "')"; int exeCount = SqlSel.ExeSql(sqlCmd); if (exeCount > 0) { //取当前单据id sqlCmd = "select max(id) from OA_Leave_Main"; string formId = SqlSel.GetSqlScale(sqlCmd).ToString(); //插入附件信息表 InsertFiles(formId); Alert.Show("提交成功!"); //表单重置 SimpleForm1.Reset(); PageContext.RegisterStartupScript("clearImg()"); //推送信息至相关审批人 pushMessage(stepId, "OA_Leave_Main", formId, "考勤申请"); } else { Alert.Show("提交失败!"); return; } } catch (Exception ex) { Alert.Show(ex.Message); } }
protected void autoLogistics(string shopId) { //DataTable dt1 = new DataTable(); //string sqlcmd="select [TradeStatus],[TradeNO],[ShopID],(select [Name] FROM [mbh_wdgj31].[dbo].[G_Cfg_LogisticList] where [G_Trade_TradeList].LogisticID= [G_Cfg_LogisticList].LogisticID) as [LogisticName]" // +" ,[PostID],[TradeNO2] from [mbh_wdgj31].[dbo].[G_Trade_TradeList] " // +" where [ShopID]='1029' and [TradeStatus]=11 and [TradeNO2] like '%-%' " // + " and [TradeNO]>(select top 1 max([TradeNO]) from WDApiFH ) and TradeFrom='蜘蛛'"; //取已同步的最大发货时间前1天所有数据去重并同步 string sqlcmd = "select [TradeStatus],[TradeNO],[ShopID],[sndtime],(select [Name] FROM" + " [mbh_wdgj31].[dbo].[G_Cfg_LogisticList] where [G_Trade_TradeList].LogisticID= [G_Cfg_LogisticList].LogisticID) as [LogisticName]" + " ,[PostID],[TradeNO2],(select nickName from g_customer_customerlist where G_Trade_TradeList.customerId=g_customer_customerlist.customerId) as nickName" + " from [mbh_wdgj31].[dbo].[G_Trade_TradeList] where [ShopID]='" + shopId + "' and [TradeStatus]=11" + " and sndTime>dateadd(day,-1,ISNULL((select max(sendtime) from WDApiFH where cipher='" + shopId + "'),'2017-09-01'))" + " and TradeFrom='蜘蛛'"; DataTable dt = new DataTable(); SqlSel.GetSqlSel(ref dt, sqlcmd); StringBuilder sb = new StringBuilder(); try { for (int i = 0; i < dt.Rows.Count; i++) { string LogisticName = dt.Rows[i]["LogisticName"].ToString(); string PostID = dt.Rows[i]["PostID"].ToString(); string orderid = dt.Rows[i]["TradeNO2"].ToString(); string tradeNo = dt.Rows[i]["TradeNO"].ToString(); string sendTime = Convert.ToDateTime(dt.Rows[i]["sndTime"]).ToString("yyyy-MM-dd HH:mm:ss.fff"); string nickName = dt.Rows[i]["nickName"].ToString(); sb.Append(mSndGoods(orderid, LogisticName, PostID, nickName, tradeNo, sendTime, shopId)); } Label1.Text = sb.ToString(); sqlcmd = "select isnull(max(rqtid),0) from wdapifh where cipher='" + shopId + "' "; int curId = Convert.ToInt32(SqlSel.GetSqlScale(sqlcmd)); //记录自动执行日志 sqlcmd = "insert into t_sfy_autoExecLog (execTime,execCount,shopId) values ('" + DateTime.Now + "'," + curId + ",'" + shopId + "')"; SqlSel.ExeSql(sqlcmd); Label_status.Text = string.Format("{0},【1039】同步物流信息完成。", DateTime.Now); //同步记录前台更新 reloadLog(); } catch (Exception ex) { Label_status.Text = ex.Message; Timer2.Enabled = false; } //dt1.DataSet.Clear(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(hidden_field.Value)) { string stepId = getStepId(ddl_flow.SelectedValue); string sqlCmd = "insert into OA_Bills_Main (reqMan,reqDte,billTotal,VoucherCount,FlowId,CurrentStepID,ReqReason,RelProj,ProveEmp) values "; sqlCmd += "('" + curUserId + "','" + DateTime.Now + "','" + numbbox_total.Text.Trim() + "','" + numbbox_count.Text.Trim() + "',"; sqlCmd += "'" + ddl_flow.SelectedValue + "','" + stepId + "','" + txa_reason.Text + "','" + ddl_proj.SelectedValue + "','" + txa_proveList.Text + "')"; int exeCount = SqlSel.ExeSql(sqlCmd); if (exeCount > 0) { //取当前单据id sqlCmd = "select max(id) from OA_Bills_Main"; string formId = SqlSel.GetSqlScale(sqlCmd).ToString(); //插入附件信息表 InsertFiles(formId); //插入关联费用项 string[] selectValueArray = ckbl_costItems.SelectedValueArray; foreach (string item in selectValueArray) { sqlCmd = "insert into OA_Bills_RelCostItems ([formId],[CostItemId]) values ("; sqlCmd += "'" + formId + "','" + item + "')"; SqlSel.ExeSql(sqlCmd); } //插入证明人表 //if (!string.IsNullOrEmpty(txa_proveList.Text)) //{ // insertProveList(txa_proveList.Text, formId); //} Alert.Show("提交成功!"); //表单重置 SimpleForm1.Reset(); PageContext.RegisterStartupScript("clearImg()"); //推送信息至相关审批人 pushMessage(stepId, "OA_Bills_Main", formId, "费用报销"); } } else { Alert.Show("请先添加相应的文件,若已添加则确认可用!"); return; } } catch (Exception ex) { Alert.Show(ex.Message); } }
//插入附件信息 private void InsertFiles(string formId) { string sqlCmd = ""; foreach (GridRow gr in Grid1.Rows) { string fileName = gr.DataKeys[0].ToString(); sqlCmd = "insert into OA_Sys_files (FormId,fileName,formDataName) values ('" + formId + "','" + fileName + "','OA_Car_Main')"; SqlSel.ExeSql(sqlCmd); } }
protected void btn_release_Click(object sender, EventArgs e) { for (int i = 0; i < Grid1.Rows.Count; i++) { int bindId = Convert.ToInt32(Grid1.DataKeys[i][0]); string sqlCmd = "update PLM_Serials_BindBarCode set OlineStatus='0' where id=" + bindId; SqlSel.ExeSql(sqlCmd); } Alert.Show("当前上架数据清空成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
protected void btn_save_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(recvId)) { string sqlCmd = "insert into OA_Sys_Step_Emp (stepId,deptId,dutyId) values ( "; sqlCmd += "'" + recvId + "','" + ddl_dept.SelectedValue + "','" + ddl_duty.SelectedValue + "')"; SqlSel.ExeSql(sqlCmd); Alert.ShowInParent("保存成功,请关闭当前窗口查看。"); SimpleForm1.Reset(); } }
protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "Delete") { int rowID = Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]); string sqlCmd = "update OA_Announcement set isDeleted='1' where id='" + rowID + "'"; SqlSel.ExeSql(sqlCmd); bindGrid(); Alert.ShowInTop("删除成功!"); } }
//插入附件信息 private void InsertFiles(string formId) { string sqlCmd = ""; foreach (GridRow gr in Grid1.Rows) { string fileName = gr.DataKeys[0].ToString(); //服务器文件名 string realFileName = gr.Values[1].ToString(); //原文件名 sqlCmd = "insert into OA_Sys_files (FormId,fileName,realFileName,formDataName) values ('" + formId + "','" + fileName + "','" + realFileName + "','OA_Announcement')"; SqlSel.ExeSql(sqlCmd); } }
protected void btn_save_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(recvId)) { string sqlCmd = "insert into OA_Sys_Flow_Step (flowId,stepName,stepOrderNo) values ("; sqlCmd += "'" + recvId + "','" + txb_stepName.Text.Trim() + "','" + getMaxSort() + "')"; SqlSel.ExeSql(sqlCmd); Alert.ShowInParent("编辑成功,请退出当前窗口!"); SimpleForm1.Reset(); //PageContext.RegisterStartupScript(ActiveWindow.GetHideReference()); } }
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; } }