protected void ib_save_Click(object sender, ImageClickEventArgs e) { int iop = operbll.UpdatePwd(CookieManager.GetCookieValue("uid"), CommonMethod.MD5Crypt(this.txt_oldpwd.Text.ToString()), CommonMethod.MD5Crypt(this.txt_newpwd.Text.ToString())); if (iop == -1) { MessageBox.Show(this, "原密码输入不正确!"); } if (iop == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "UPDATE Sys_Operator SET Password='******' WHERE UserCode='" + CookieManager.GetCookieValue("uid") + "'"; strSQL = msm.AllStation + msm.Prefix + "Sys_Operator" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } #endregion ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('密码修改成功!');top.currForm.close();", true); } if (iop == 0) { MessageBox.Show(this, "修改失败!"); } }
//重置密码 protected void lbsetpwd_Click(object sender, EventArgs e) { string str = GetSelect(""); int iop = 0; iop = operbll.setdefautpwd(str, CommonMethod.MD5Crypt("12345")); if (iop > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { string strSQL = "Update SYS_Operator Set Password='******' where UserCode in (" + str + ")"; IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); strSQL = msm.AllStation + msm.Prefix + "Sys_Operator" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } #endregion } #endregion ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('密码重置成功!')", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('密码重置失败!')", true); } }
//禁用 protected void lkForbid_Click(object sender, EventArgs e) { string strKey = GetKeyValue("1"); if (strKey == "") { MessageBox.Show(this.UpdatePanel1, this, "您选择的部门已经是禁用状态,不能再禁用!"); return; } if (strKey.Contains("'" + CookieManager.GetCookieValue("orgID").ToString() + "'")) { MessageBox.Show(this.UpdatePanel1, this, "您选择的部门中有当前登录用户的所属部门,不能再禁用!"); return; } //if (bll.GetPositionCountByOrgId(Convert.ToDecimal(strKey)) > 0) //{ // ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('您选择的部门下有职务,不能删除!');", true); // return; //} //if (bll.GetOperatorCountByOrgId(Convert.ToDecimal(strKey)) > 0) //{ // ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('您选择的部门下有有人员,不能删除!');", true); // return; //} if (strKey == "0") { MessageBox.Show(this.UpdatePanel1, this, "此部门不能禁用!"); return; } string strSQL = "Update Sys_Organization set [IsForbid] = 1 " + " Where [OrgCode] IN(" + strKey + ") "; if (DbHelperSQL.ExecuteSql(strSQL) > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); strSQL = msm.AllStation + msm.Prefix + "Sys_Organization" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion lk_Click(sender, e); ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('禁用成功!');", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('禁用失败!');", true); } }
protected void lkDelete_Click(object sender, EventArgs e) { string strselect = GetSelect(); if ("" != strselect) { if (GetSelect().LastIndexOf(",") == -1) { string strSQL = "Update Sys_Dictionary Set IsForbid= '0' Where BusinID='" + strselect.Split('|')[0] + "' And BusinTypeID='" + strselect.Split('|')[1] + "'"; if (DbHelperSQL.ExecuteSql(strSQL) > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); strSQL = msm.AllStation + msm.Prefix + "Sys_Dictionary" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //List<string> iplist = ControlBindHelper.GetAllRoomIP(); //for (int i = 0; i < iplist.Count; i++) //{ // if (iplist[i] != "") // { // EndpointAddress ep = new EndpointAddress("net.msmq://" + iplist[i] + "/private/STOCMessagingQueue"); // NetMsmqBinding et = new NetMsmqBinding(); // et.ExactlyOnce = false; // et.Security.Mode = System.ServiceModel.NetMsmqSecurityMode.None; // IDataPublish proxy = ChannelFactory<IDataPublish>.CreateChannel(et, ep); // proxy.IndustryPlatform_Dictionary_Delete(strselect.Split('|')[0], strselect.Split('|')[1]); // } //} } catch { } } #endregion ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "alert('启用成功!');", true); this.DBind(); } else { ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "alert('启用失败!');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('启用只能选择一条!');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('请选择启用数据!');", true); } }
//启用 protected void lkStart_Click(object sender, EventArgs e) { string str = GetSelect("0"); if (str == "") { MessageBox.Show(this.UpdatePanel1, this, "您选择的用户已经是启用状态,不能再启用!"); return; } else { str = str.Replace("'" + CookieManager.GetCookieValue("uid") + "'", "").Replace(",,", ",").TrimEnd(','); if (str == "" || str == "0") { MessageBox.Show(this.UpdatePanel1, this, "您选择的用户是当前登录用户,不能再启用!"); return; } } //int iop = operbll.DelOperator(str); string strSQL = "Update Sys_Operator Set IsForbid = 0 Where UserCode IN (" + str + ")"; int iop = DbHelperSQL.ExecuteSql(strSQL); if (iop > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); strSQL = msm.AllStation + msm.Prefix + "Sys_Operator" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); string strKQSQL = "update 员工 set 黑名单=0 where 员工编号 in (" + str + ")"; msm.AddMsmq(strKQSQL, System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString()); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('操作成功!但是数据下发失败" + ex.Message + "')", true); } } #endregion ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('操作成功!')", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('操作失败!')", true); } DBind(); }
protected void imgbtnDelete_Click(object sender, ImageClickEventArgs e) { List <string> listMenus = GetMenUserCodes(); int retVal = menuBll.BatchDelete(listMenus); if (retVal == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); foreach (string strMenuID in listMenus) { string strSQL = "Delete From Sys_Menu Where MenuID='" + strMenuID + "'"; strSQL = msm.AllStation + msm.Prefix + "Sys_Menu" + msm.Prefix + msm.DelFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } //List<string> iplist = ControlBindHelper.GetAllRoomIP(); //for (int i = 0; i < iplist.Count; i++) //{ // if (iplist[i] != "") // { // EndpointAddress ep = new EndpointAddress("net.msmq://" + iplist[i] + "/private/STOCMessagingQueue"); // NetMsmqBinding et = new NetMsmqBinding(); // et.ExactlyOnce = false; // et.Security.Mode = System.ServiceModel.NetMsmqSecurityMode.None; // IDataPublish proxy = ChannelFactory<IDataPublish>.CreateChannel(et, ep); // proxy.IndustryPlatform_Menu_BatchDelete(listMenus); // } //} } catch { } } #endregion tv_Menu.Nodes.Clear(); menuBll.BuildTree(tv_Menu, PositionCodes); tv_Menu.ExpandAll(); LoadData(); ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('删除成功!');", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('删除失败!');", true); } }
protected void btn_Edit_Click(object sender, ImageClickEventArgs e) { position.DelMenuPosition(Request.QueryString["PositonID"]); List <string> listMenus = new List <string>(); for (int i = 0; i < tvmeun.Nodes.Count; i++) { if (tvmeun.Nodes[i].ChildNodes.Count > 0) //判断是否还有子节点 { GetNode(tvmeun.Nodes[i], ref listMenus); } if (tvmeun.Nodes[i].Checked == true) //判断是否被选中 { listMenus.Add(tvmeun.Nodes[i].Value); //string s = tvmeun.Nodes[i].Value.ToString(); //h_Count.Value=position.AddMenuPosition(Request.QueryString["PositonID"], s).ToString(); } } if (position.AddMenuPosition(Request.QueryString["PositonID"], listMenus) == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { string strPositonID = Request.QueryString["PositonID"]; IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "Delete From Sys_MenuPosition Where PositionCode='" + strPositonID + "';"; foreach (string strCode in listMenus) { strSQL += " INSERT INTO Sys_MenuPosition ( " + "[PositionCode] ," + "[MenuID] ) VALUES ('" + strPositonID + "','" + strCode + "');"; } strSQL = msm.AllStation + msm.Prefix + "Sys_MenuPosition" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "top.currForm.close();", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('权限设置失败!');", true); } }
protected void LkEmbargoor_Click(object sender, EventArgs e) { string strselect = GetSelect("0"); if ("" != strselect) { string strSQL = "Update Sys_Position set [IsForbid] = 0 " + " Where [PositionCode] IN(" + strselect + ") "; if (DbHelperSQL.ExecuteSql(strSQL) > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); strSQL = msm.AllStation + msm.Prefix + "Sys_Position" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion position.DelMenuPosition(strselect); if (ViewState["Node"] == null) { ViewState["Node"] = ""; } IndexLoadBind(); ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "alert('操作成功!'); ", true); } else { ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "alert('操作失败!');", true); } } else { MessageBox.Show(this.UpdatePanel1, this, "您选择的记录已经是启用状态!"); } }
protected void ib_save_Click(object sender, ImageClickEventArgs e) { int iop = 0; string str = GetSelect(); if (operid != "0") { iop = operbll.AddOperPosition(operid, str); } if (iop > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "Delete From Sys_OperatorPosition Where [UserCode]='" + operid + "';"; string[] strArrPID = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < strArrPID.Length; i++) { strSQL += "INSERT INTO Sys_OperatorPosition ( " + "[PositonCode] ," + "[UserCode] ) VALUES ('" + strArrPID[i] + "','" + operid + "');"; } strSQL = msm.AllStation + msm.Prefix + "Sys_OperatorPosition" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "top.currForm.close();", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('设置失败!')", true); } // ClientScript.RegisterStartupScript(Page.GetType(), "", "this.top.currForm.close();//this.top.currForm.returnvalue='aa';", true); }
//禁用煤矿 protected void lkForbid_Click(object sender, EventArgs e) { string strselect = GetSelect("1"); if ("" != strselect) { if (coll.Forbid(strselect, "1") == 1) { #region 步数据 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "update Sys_Colliery set IsForbid = 1 " + "Where CollCode In(" + strselect + ")"; strSQL = msm.AllStation + msm.Prefix + "Sys_Colliery" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion DBind(); ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "alert('禁用成功!');", true); } else { ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "alert('禁用失败!');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('您选中的煤矿已经是禁用状态!');", true); } }
protected void btn_Save_Click(object sender, ImageClickEventArgs e) { entity_dic = new IndustryPlatform.Model.SYS_DictionaryEntity(); #region 初始化数据 entity_dic.BusinName = this.txt_name.Text.Trim(); entity_dic.BusinTypeID = this.ddl_type.SelectedValue; entity_dic.IsForbid = this.cb_status.Checked == true ? "1" : "0"; //entity_dic.privilege = 0; //if (this.txt_privilege.Text.Trim()!="") // entity_dic.privilege = Convert.ToDecimal(this.txt_privilege.Text.Trim()); #endregion bll_dic = new SYS_Dictionary(); bool isOk = false; if (Request.QueryString["did"] == null) //添加 { if (bll_dic.Exists(entity_dic.BusinTypeID, entity_dic.BusinName, "")) { MessageBox.Show(this.upDepartAdd, this, "您输入的名称在[" + this.ddl_type.SelectedItem.Text + "]类型中已经存在,请重新输入!"); return; } lock (this) { entity_dic.BusinID = DbHelperSQL.GetMaxID("businID", "SYS_Dictionary", " businTypeID=" + entity_dic.BusinTypeID).ToString(); // 获得最大ID isOk = bll_dic.Add(entity_dic); } } else //修改 { entity_dic.BusinID = Request.QueryString["did"]; if (bll_dic.Exists(entity_dic.BusinTypeID, entity_dic.BusinName, entity_dic.BusinID)) { MessageBox.Show(this.upDepartAdd, this, "您输入的名称在[" + this.ddl_type.SelectedItem.Text + "]类型中已经存在,请重新输入!"); return; } //entity_dic.businTypeID = Request.QueryString["tid"]; isOk = bll_dic.Update(entity_dic); } if (isOk) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { ////添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); if (entity_dic.DisplayOrder == null) { entity_dic.DisplayOrder = 0; } if (Request.QueryString["did"] == null || Request.QueryString["did"] == "") {//添加 string strSQL = "INSERT INTO Sys_Dictionary ( " + "[BusinID] ," + "[BusinName] ," + "[BusinTypeID] ," + "[DisplayOrder] ," + "[IsForbid] ," + "[OtherInfo] ) VALUES ('" + entity_dic.BusinID + "','" + entity_dic.BusinName + "','" + entity_dic.BusinTypeID + "'," + entity_dic.DisplayOrder + ",'" + entity_dic.IsForbid + "','')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Dictionary" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } else {//修改 string strSQL = "Delete From Sys_Dictionary Where BusinID='" + entity_dic.BusinID + "' And BusinTypeID='" + entity_dic.BusinTypeID + "';"; strSQL += "INSERT INTO Sys_Dictionary ( " + "[BusinID] ," + "[BusinName] ," + "[BusinTypeID] ," + "[DisplayOrder] ," + "[IsForbid] ," + "[OtherInfo] ) VALUES ('" + entity_dic.BusinID + "','" + entity_dic.BusinName + "','" + entity_dic.BusinTypeID + "'," + entity_dic.DisplayOrder + ",'" + entity_dic.IsForbid + "','');"; strSQL = msm.AllStation + msm.Prefix + "Sys_Dictionary" + msm.Prefix + msm.DelFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } //List<string> iplist = ControlBindHelper.GetAllRoomIP(); //for (int i = 0; i < iplist.Count; i++) //{ // if (iplist[i] != "") // { // EndpointAddress ep = new EndpointAddress("net.msmq://" + iplist[i] + "/private/STOCMessagingQueue"); // NetMsmqBinding et = new NetMsmqBinding(); // et.ExactlyOnce = false; // et.Security.Mode = System.ServiceModel.NetMsmqSecurityMode.None; // IDataPublish proxy = ChannelFactory<IDataPublish>.CreateChannel(et, ep); // if (Request.QueryString["did"] == null) // proxy.IndustryPlatform_Dictionary_Add(entity_dic); // else // proxy.IndustryPlatform_Dictionary_Update(entity_dic); // } //} } catch { } } #endregion if (Request.QueryString["did"] == null) { MessageBox.Show(this.upDepartAdd, this, "保存成功!"); initPage(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "top.currForm.close();", true); } } else { MessageBox.Show(this.upDepartAdd, this, "保存失败!"); } }
//启用 protected void lkStart_Click(object sender, EventArgs e) { string strKey = GetKeyValue("0"); if (strKey == "") { MessageBox.Show(this.UpdatePanel1, this, "您选择的部门已经是启用状态,不能再启用!"); return; } //if (bll.GetPositionCountByOrgId(Convert.ToDecimal(strKey)) > 0) //{ // ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('您选择的部门下有职务,不能删除!');", true); // return; //} //if (bll.GetOperatorCountByOrgId(Convert.ToDecimal(strKey)) > 0) //{ // ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('您选择的部门下有有人员,不能删除!');", true); // return; //} //if (strKey == "0") //{ // MessageBox.Show(this.UpdatePanel1, this, "此部门不能禁用!"); // return; //} string strSQL = "Update Sys_Organization set [IsForbid] = 0 " + " Where [OrgCode] IN(" + strKey + ") "; if (DbHelperSQL.ExecuteSql(strSQL) > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); strSQL = msm.AllStation + msm.Prefix + "Sys_Organization" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //List<string> iplist = ControlBindHelper.GetAllRoomIP(); //for (int i = 0; i < iplist.Count; i++) //{ // if (iplist[i] != "") // { // EndpointAddress ep = new EndpointAddress("net.msmq://" + iplist[i] + "/private/STOCMessagingQueue"); // NetMsmqBinding et = new NetMsmqBinding(); // et.ExactlyOnce = false; // et.Security.Mode = System.ServiceModel.NetMsmqSecurityMode.None; // IDataPublish proxy = ChannelFactory<IDataPublish>.CreateChannel(et, ep); // proxy.IndustryPlatform_Organization_Delete(strKey); // } //} } catch { } } #endregion lk_Click(sender, e); ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('启用成功!');", true); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "alert('启用失败!');", true); } }
protected void btn_Save_Click(object sender, ImageClickEventArgs e) { SYS_PositionEntity Entity = new SYS_PositionEntity(); if (Request.QueryString["PositonID"] != null) { Entity = position.GetModel(Request.QueryString["PositonID"].ToString()); } Entity.PositionName = this.txt_PositionName.Text; Entity.Remark = this.txt_Remark.Text; Entity.IsForbid = "0"; if (Request.QueryString["PositonID"] != null)//修改保存 { DataSet pDs = position.GetPositionList(" PositionName='" + CommonMethod.RepChar(Entity.PositionName) + "' and PositionCode<>'" + Request.QueryString["PositonID"].ToString() + "'"); if (pDs.Tables[0].Rows.Count > 0) { MessageBox.Show(this.upDepartAdd, this, "您输入的职位名称已经存在!"); return; } if (position.Update(Entity) == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "update Sys_Position set " + "[PositionCode] = '" + Entity.PositionCode + "'," + "[PositionName] = '" + CommonMethod.RepChar(Entity.PositionName) + "'," + "[Remark] = '" + CommonMethod.RepChar(Entity.Remark) + "'," + "[IsForbid] = '" + Entity.IsForbid + "' where [PositionCode]='" + Entity.PositionCode + "'"; strSQL = msm.AllStation + msm.Prefix + "Sys_Position" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('修改成功!'); top.currForm.close();", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('修改失败!');", true); } } else//新增保存 { DataSet pDs = position.GetPositionList(" PositionName='" + CommonMethod.RepChar(Entity.PositionName) + "'"); if (pDs.Tables[0].Rows.Count > 0) { MessageBox.Show(this.upDepartAdd, this, "您输入的职位名称已经存在!"); return; } lock (this) { Entity.PositionCode = DbHelperSQL.GetBaseMaxID("PositionCode", "SYS_Position", " PositionCode<>'0'"); Entity.IsForbid = "0"; if (position.Add(Entity) == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "INSERT INTO Sys_Position ( " + "[PositionCode] ," + "[PositionName] ," + "[Remark] ," + "[IsForbid] ) VALUES ('" + Entity.PositionCode + "','" + CommonMethod.RepChar(Entity.PositionName) + "','" + CommonMethod.RepChar(Entity.Remark) + "','" + Entity.IsForbid + "')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Position" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion SetText(); ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('添加成功!');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('添加失败!');", true); } } } }
protected void ib_save_Click(object sender, ImageClickEventArgs e) { lock (this) { if (CookieManager.GetCookieValue("uid").ToString() == "0" && this.ddl_parentOrgID.SelectedIndex == 0) { // MessageBox.Show(this, "请选择部门"); MessageBox.Show(this.UpdatePanel1, this, "请选择部门"); return; } if (this.ddl_TypeCode.Visible == true && this.ddl_TypeCode.Items[0].Text == "请选择磅房") { if (this.ddl_TypeCode.SelectedValue == "") { //MessageBox.Show(this, ddl_TypeCode.Items[0].Text); MessageBox.Show(this.UpdatePanel1, this, ddl_TypeCode.Items[0].Text); return; } } int checkid = operbll.Ch(this.txt_username.Text.ToString()); if (checkid == 1) { //MessageBox.Show(this, "您输入的用户姓名已经存在,请重新输入!"); MessageBox.Show(this.UpdatePanel1, this, "您输入的用户姓名已经存在,请重新输入!"); return; } SYS_OperatorEntity operEntity = new SYS_OperatorEntity(); operEntity.Gender = this.rblist_sex.SelectedValue.ToString(); operEntity.Address = this.txt_address.Text.ToString(); operEntity.IsForbid = "0"; operEntity.MobileNo = this.txt_mobile.Text.ToString(); operEntity.Email = this.txt_email.Text.ToString(); operEntity.UserCode = DbHelperSQL.GetBaseMaxID("UserCode", "Sys_Operator", "UserCode<>'0'").ToString(); operEntity.OrgCode = this.ddl_parentOrgID.SelectedValue; //operEntity.TypeCode = this.ddl_TypeCode.SelectedValue; operEntity.Password = CommonMethod.MD5Crypt("12345"); operEntity.PID = this.txt_pid.Text.ToString(); operEntity.RegDate = Convert.ToDateTime(System.DateTime.Now); operEntity.UserName = this.txt_username.Text.ToString(); operEntity.Tel = this.txt_tel.Text; if (ddl_TypeCode.Visible) { operEntity.TypeCode = this.ddl_TypeCode.SelectedValue; } else { operEntity.TypeCode = "0"; } operEntity.ZipCode = this.zipcode.Text.ToString(); int isign = operbll.AddOperator(operEntity); if (isign == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "INSERT INTO Sys_Operator ( " + "[UserCode] ," + "[UserName] ," + "[Password] ," + "[IsForbid] ," + "[OrgCode] ," + "[Tel] ," + "[Email] ," + "[Address] ," + "[ZipCode] ," + "[PID] ," + "[Gender] ," + "[RegDate] ," + "[MobileNo] ," + "[TypeCode] ) VALUES ('" + operEntity.UserCode + "','" + CommonMethod.RepChar(operEntity.UserName) + "','" + CommonMethod.RepChar(operEntity.Password) + "','" + operEntity.IsForbid + "','" + operEntity.OrgCode + "','" + operEntity.Tel + "','" + operEntity.Email + "','" + CommonMethod.RepChar(operEntity.Address) + "','" + operEntity.ZipCode + "','" + operEntity.PID + "','" + operEntity.Gender + "','" + operEntity.RegDate + "','" + operEntity.MobileNo + "','" + operEntity.TypeCode + "')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Operator" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //向考勤机发送同步数据 if (System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString() != "") { string kqSql = "INSERT INTO [HMKQ].[dbo].[员工]" + "([员工编号]" + ",[姓名]" + //",[虹膜代码]"+ //",[虹膜代码2]"+ //",[虹膜代码3]"+ ",[密码]" + ",[部门]" + //",[组别]"+ //",[自定义编号]"+ ",[管理权]" + ",[黑名单])" + //",[照片])"+ " VALUES" + "('" + operEntity.UserCode + "','" + operEntity.UserName + "','" + CommonMethod.RepChar(operEntity.Password) + "','" + operEntity.OrgCode + "',0,0)"; msm.AddMsmq(kqSql, System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString());//语句,IP } } catch { } } #endregion setnull(); //MessageBox.Show(this, "添加成功!"); MessageBox.Show(this.UpdatePanel1, this, "添加成功!"); } else { //MessageBox.Show(this, "添加失败!"); MessageBox.Show(this.UpdatePanel1, this, "添加失败!"); } } }
protected void ib_save_Click(object sender, ImageClickEventArgs e) { if (CookieManager.GetCookieValue("uid").ToString() == "0" && this.ddl_parentOrgID.SelectedIndex == 0) { MessageBox.Show(this.UpdatePanel1, this, "请选择部门"); return; } if (this.ddl_TypeCode.Visible == true) { if (this.ddl_TypeCode.SelectedValue == "") { MessageBox.Show(this.UpdatePanel1, this, this.ddl_TypeCode.Items[0].Text); return; } } if (DbHelperSQL.Exists("Select Count(0) from Sys_Operator where UserName='******'", "''") + "' and UserCode<>'" + Request.QueryString["operid"].ToString() + "'")) { MessageBox.Show(this.UpdatePanel1, this, "您输入的用户名已经存在!"); return; } SYS_OperatorEntity operEntity = new SYS_OperatorEntity(); operEntity = operbll.GetModel(Request.QueryString["operid"].ToString()); operEntity.Gender = this.rblist_sex.SelectedValue.ToString(); operEntity.Address = this.txt_address.Text.ToString(); operEntity.MobileNo = this.txt_mobile.Text.ToString(); operEntity.Email = this.txt_email.Text.ToString(); //operEntity. = Convert.ToDecimal(operbll.GetMaxID("operatorID", "SYS_Operator")); operEntity.OrgCode = this.ddl_parentOrgID.SelectedValue; operEntity.TypeCode = this.ddl_TypeCode.SelectedValue; operEntity.PID = this.txt_pid.Text.ToString(); operEntity.RegDate = Convert.ToDateTime(System.DateTime.Now); operEntity.UserName = this.txt_username.Text.ToString(); operEntity.Tel = this.txt_tel.Text; if (ddl_TypeCode.Visible) { operEntity.TypeCode = this.ddl_TypeCode.SelectedValue; } else { operEntity.TypeCode = "0"; } operEntity.ZipCode = this.zipcode.Text.ToString(); int isign = operbll.UpdateOperator(operEntity); if (isign == 1) { //MessageBox.Show(this, "修改成功!"); #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "Update Sys_Operator set " + "[UserCode] = '" + operEntity.UserCode + "', " + "[UserName] = '" + CommonMethod.RepChar(operEntity.UserName) + "', " + "[Password] = '" + CommonMethod.RepChar(operEntity.Password) + "', " + "[IsForbid] = '" + operEntity.IsForbid + "', " + "[OrgCode] = '" + operEntity.OrgCode + "', " + "[Tel] = '" + operEntity.Tel + "', " + "[Email] = '" + operEntity.Email + "' ," + "[Address] = '" + CommonMethod.RepChar(operEntity.Address) + "', " + "[ZipCode] = '" + operEntity.ZipCode + "', " + "[PID] = '" + operEntity.PID + "', " + "[Gender] = '" + operEntity.Gender + "', " + "[RegDate] = '" + operEntity.RegDate + "', " + "[MobileNo] = '" + operEntity.MobileNo + "', " + "[TypeCode] = '" + operEntity.TypeCode + "' " + " where [UserCode]='" + CommonMethod.RepChar(operEntity.UserCode) + "'"; strSQL = msm.AllStation + msm.Prefix + "Sys_Operator" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //向考勤机发送更新语句 if (System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString() != null) { string strKQSQL = "UPDATE [HMKQ].[dbo].[员工]" + "SET [姓名] = '" + operEntity.UserName + "'" + " ,[密码] = '" + CommonMethod.RepChar(operEntity.Password) + "'" + ",[部门] = '" + operEntity.OrgCode + "'" + "WHERE [员工编号]='" + operEntity.UserCode + "'"; msm.AddMsmq(strKQSQL, System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString()); } } catch { } } #endregion ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), "", "top.currForm.close();", true); } else { MessageBox.Show(this.UpdatePanel1, this, "修改失败!"); } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (this.ddlParents.SelectedIndex == 0) { MessageBox.Show(this, "请选择父节点!"); return; } if (Request.QueryString["menuID"] != null) { if (this.chkIsLeaf.Checked) { if (DbHelperSQL.Exists("Select Count(0) from Sys_Menu where ParentsID='" + Request.QueryString["menuID"].ToString() + "'")) { MessageBox.Show(this, "您修改的节点下面还有子节点,不能修改成叶子节点!"); return; } } } BuildModel(); if (string.IsNullOrEmpty(Request.QueryString["menuID"])) { string strparentsID = "0"; if (this.ddlParents.SelectedIndex != 0) { strparentsID = this.ddlParents.SelectedValue; } DataTable dtExist = menuBll.GetList(" menuName='" + this.txtMenuName.Text.Trim().Replace("'", "''") + "' and parentsID='" + strparentsID + "'").Tables[0]; if (dtExist.Rows.Count > 0) { MessageBox.Show(this, "同父级别下的菜单名称不能重复,请重新输入!"); return; } if (menuBll.Add(menuModel) == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "INSERT INTO Sys_Menu ( " + "[MenuID] ," + "[MenuName] ," + "[MenuUrl] ," + "[FunctionID] ," + "[IsLeaf] ," + "[MenuLevel] ," + "[RootID] ," + "[ParentsID] ," + "[DisplayOrder] ," + "[IcValue] ," + "[IsPop] ," + "[MenuSeq] ) VALUES ('" + menuModel.MenuID + "','" + CommonMethod.RepChar(menuModel.MenuName) + "','" + CommonMethod.RepChar(menuModel.MenuUrl) + "','" + menuModel.FunctionID + "','" + menuModel.IsLeaf + "','" + menuModel.MenuLevel + "','" + menuModel.RootID + "','" + menuModel.ParentsID + "'," + menuModel.DisplayOrder + ",'" + menuModel.IcValue + "','" + menuModel.IsPop + "','" + menuModel.MenuSeq + "')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Menu" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //List<string> iplist = ControlBindHelper.GetAllRoomIP(); //for (int i = 0; i < iplist.Count; i++) //{ // if (iplist[i] != "") // { // EndpointAddress ep = new EndpointAddress("net.msmq://" + iplist[i] + "/private/STOCMessagingQueue"); // NetMsmqBinding et = new NetMsmqBinding(); // et.ExactlyOnce = false; // et.Security.Mode = System.ServiceModel.NetMsmqSecurityMode.None; // IDataPublish proxy = ChannelFactory<IDataPublish>.CreateChannel(et, ep); // proxy.IndustryPlatform_Menu_Add(menuModel); // } //} } catch { } } #endregion MessageBox.Show(this, "添加成功!"); SetText(); menuBll.BindDdl(ddlParents, PositionCodes); } else { MessageBox.Show(this, "添加失败!"); } } else//更新操作 { menuModel.MenuID = Request.QueryString["MenuID"]; string strparentsID = "0"; if (this.ddlParents.SelectedIndex != 0) { strparentsID = this.ddlParents.SelectedValue; } DataTable dtExist = menuBll.GetList(" menuName='" + this.txtMenuName.Text.Trim().Replace("'", "''") + "' and MenuID<>'" + menuModel.MenuID + "' and ParentsID='" + strparentsID + "'").Tables[0]; if (dtExist.Rows.Count > 0) { MessageBox.Show(this, "同父级别下的菜单名称不能重复,请重新输入!"); return; } if (menuBll.IsChildren(menuModel.MenuID, ddlParents.SelectedValue)) { MessageBox.Show(this, "不要选择该菜单项下的子菜单项作为父菜单!"); //菜单项实体 IndustryPlatform.Model.SYS_MenuEntity menu = menuBll.GetModel(menuModel.MenuID); ddlParents.SelectedValue = menu.ParentsID; } else { if (menuBll.Update(menuModel) == 1) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 if (menuModel.DisplayOrder == null) { menuModel.DisplayOrder = 0; } //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "Delete From Sys_Menu Where MenuID='" + menuModel.MenuID + "'; "; strSQL += "INSERT INTO Sys_Menu ( " + "[MenuID] ," + "[MenuName] ," + "[MenuUrl] ," + "[FunctionID] ," + "[IsLeaf] ," + "[MenuLevel] ," + "[RootID] ," + "[ParentsID] ," + "[DisplayOrder] ," + "[IcValue] ," + "[IsPop] ," + "[MenuSeq] ) VALUES ('" + menuModel.MenuID + "','" + CommonMethod.RepChar(menuModel.MenuName) + "','" + CommonMethod.RepChar(menuModel.MenuUrl) + "','" + menuModel.FunctionID + "','" + menuModel.IsLeaf + "','" + menuModel.MenuLevel + "','" + menuModel.RootID + "','" + menuModel.ParentsID + "'," + menuModel.DisplayOrder + ",'" + menuModel.IcValue + "','" + menuModel.IsPop + "','" + menuModel.MenuSeq + "')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Menu" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } catch { } } #endregion ClientScript.RegisterStartupScript(Page.GetType(), "", "this.top.currForm.close();", true); } else { MessageBox.Show(this, "修改失败!"); } } } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { decimal orgID = 0; if (Request.QueryString["orgid"] != null) { orgID = Convert.ToDecimal(Request.QueryString["orgid"]); model = bll.GetModel(orgID.ToString()); if (this.ddl_parentOrgID.SelectedIndex != 0) { DataTable dt = bll.GetList(" OrgSEQ like '" + model.OrgSeq + "%'").Tables[0]; DataRow[] drs = dt.Select("OrgCode=" + this.ddl_parentOrgID.SelectedValue); if (drs.Length > 0) { MessageBox.Show(this, "不能选择自己和自己下级作为父节点,请重新选择!"); return; } } string strparentOrgID = "0"; IndustryPlatform.Model.SYS_Organization m = new IndustryPlatform.Model.SYS_Organization(); if (this.ddl_parentOrgID.SelectedIndex != 0) { strparentOrgID = this.ddl_parentOrgID.SelectedValue; } DataTable dtExistName = bll.GetList(" ParentOrgCode ='" + strparentOrgID + "' and orgName='" + this.txt_OrgName.Text.Trim().Replace("'", "''") + "' and OrgCode<>" + Request.QueryString["orgid"].ToString()).Tables[0]; if (dtExistName.Rows.Count > 0) { MessageBox.Show(this, "同父级别下的部门名称不能重复,请重新输入!"); return; } } else { model.IsForbid = "0"; string strparentOrgID = "0"; IndustryPlatform.Model.SYS_Organization m = new IndustryPlatform.Model.SYS_Organization(); if (this.ddl_parentOrgID.SelectedIndex != 0) { strparentOrgID = this.ddl_parentOrgID.SelectedValue; } DataTable dtExistName = bll.GetList(" ParentOrgCode='" + strparentOrgID + "' and orgName='" + this.txt_OrgName.Text.Trim().Replace("'", "''") + "'").Tables[0]; if (dtExistName.Rows.Count > 0) { MessageBox.Show(this, "同父级别下的部门名称不能重复,请重新输入!"); return; } } model.Email = this.txt_Email.Text.Trim(); model.LinkMan = this.txt_LinkMan.Text.Trim(); model.LinkManTel = this.txt_LinkManTel.Text.Trim(); model.Remark = this.txt_memo.Text.Trim(); model.OrgName = this.txt_OrgName.Text.Trim(); model.OrgType = this.ddlOrgType.SelectedValue; if (this.ddl_parentOrgID.SelectedValue != "") { model.ParentOrgCode = this.ddl_parentOrgID.SelectedValue; } else { model.ParentOrgCode = bll.GetModel(CookieManager.GetCookieValue("orgID").ToString()).ParentOrgCode; } model.OrgLevel = "1"; if (this.ddl_parentOrgID.SelectedValue != "0" && this.ddl_parentOrgID.SelectedValue != "") { model.OrgLevel = Convert.ToString(Convert.ToInt32(bll.GetModel(model.ParentOrgCode).OrgLevel) + 1); } else if (this.ddl_parentOrgID.SelectedValue == "") { if (model.ParentOrgCode == "0") { model.OrgLevel = "1"; } } if (Request.QueryString["orgid"] == null) { model.OrgCode = DbHelperSQL.GetBaseMaxID("OrgCode", "Sys_Organization", "OrgCode<>'0'"); if (bll.Add(model) > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //添加成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "INSERT INTO Sys_Organization ( " + "[OrgCode] ," + "[OrgName] ," + "[OrgLevel] ," + "[ParentOrgCode] ," + "[OrgSeq] ," + "[OrgType] ," + "[LinkMan] ," + "[LinkManTel] ," + "[Email] ," + "[IsForbid] ," + "[Remark] ," + "[SysCode] ) VALUES ('" + model.OrgCode + "','" + CommonMethod.RepChar(model.OrgName) + "','" + model.OrgLevel + "','" + model.ParentOrgCode + "','" + model.OrgSeq + "','" + model.OrgType + "','" + CommonMethod.RepChar(model.LinkMan) + "','" + model.LinkManTel + "','" + model.Email + "','" + model.IsForbid + "','" + CommonMethod.RepChar(model.Remark) + "','" + model.SysCode + "')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Organization" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //添加考勤信息 if (System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString() != "") { string strKQSQL = "INSERT INTO [HMKQ].[dbo].[t_UNIT]" + "([unitCode]" + ",[unitName]" + ",[upUnitCode]" + //",[unitEnv]"+ ",[unitLev])" + "VALUES" + "('" + model.OrgCode + "'" + ",'" + model.OrgName + "'" + ",'" + model.ParentOrgCode + "'" + ",'" + model.OrgLevel + "')"; msm.AddMsmq(strKQSQL, System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString()); } } catch { } } #endregion bll.OrgDllBind(this.ddl_parentOrgID, ViewState["SEQ"].ToString(), ViewState["pid"].ToString()); MessageBox.Show(this, "添加成功!"); SetText(); } else { MessageBox.Show(this, "添加失败!"); } } else { if (bll.Update(model) > 0) { #region 数据同步 if (ConfigurationManager.AppSettings["IsSync"] == "1") { try { //更新成功,数据同步到各个磅房 IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "update Sys_Organization set " + "[OrgCode] = '" + model.OrgCode + "'," + "[OrgName] = '" + CommonMethod.RepChar(model.OrgName) + "'," + "[OrgLevel] = '" + model.OrgLevel + "'," + "[ParentOrgCode] = '" + model.ParentOrgCode + "'," + "[OrgSeq] = '" + model.OrgSeq + "'," + "[OrgType] = '" + model.OrgType + "'," + "[LinkMan] = '" + CommonMethod.RepChar(model.LinkMan) + "'," + "[LinkManTel] = '" + model.LinkManTel + "'," + "[Email] = '" + model.Email + "'," + "[IsForbid] = '" + model.IsForbid + "'," + "[Remark] = '" + CommonMethod.RepChar(model.Remark) + "'," + "[SysCode] = '" + model.SysCode + "' where [OrgCode]='" + model.OrgCode + "'"; strSQL = msm.AllStation + msm.Prefix + "Sys_Organization" + msm.Prefix + msm.EditFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); //更新考勤信息 if (System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString() != "") { string strKQSQL = "UPDATE [HMKQ].[dbo].[t_UNIT]" + "SET " + "[unitName] = '" + model.OrgName + "'" + ",[upUnitCode] = " + model.ParentOrgCode + "" + //" ,[unitEnv] = "++""+ ",[unitLev] = " + model.OrgLevel + "" + " WHERE [unitCode] = '" + model.OrgCode + "'"; msm.AddMsmq(strKQSQL, System.Configuration.ConfigurationManager.AppSettings["ConnKQIP"].ToString()); } } catch { } } #endregion bll.OrgDllBind(this.ddl_parentOrgID, ViewState["SEQ"].ToString(), ViewState["pid"].ToString()); ClientScript.RegisterStartupScript(Page.GetType(), "", "this.top.currForm.close();", true); } else { MessageBox.Show(this, "修改失败!"); } } }
protected void btn_Save_Click(object sender, ImageClickEventArgs e) { if (ddlCollState.SelectedIndex == 0) { MessageBox.Show(this.upDepartAdd, this, "请选择煤矿状态"); return; } if (ddlCollProperty.SelectedIndex == 0) { MessageBox.Show(this.upDepartAdd, this, "请选择煤矿属性"); return; } if (strCustomer == "FuYuan") { if (this.ddlParcel.SelectedIndex == 0) { MessageBox.Show(this.upDepartAdd, this, "请选择片区"); return; } } //判断煤矿编号是否有重复 if (Request.QueryString["CollID"] == null) { if (DbHelperSQL.Exists("Select Count(0) from Sys_Colliery where CollName='" + this.txtCollName.Text.Trim().Replace("'", "''") + "'")) { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('煤矿名称已经存在,请重新输入!');", true); this.txtCollName.Focus(); return; } } else { //判断标示卡中是否存在该煤矿 //if (txtCollCode.Enabled != false) //{ if ("0" != bll.Getresult("count(*)", "Sys_Colliery", "CollCode !='" + Request.QueryString["CollID"].ToString() + "' and CollName='" + this.txtCollName.Text + "'")) { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('煤矿名称已经存在,请重新输入!');", true); return; } //} } #region 将煤矿信息存放到实体中 string strExtent = ".gif.png.jpg.bmp.psd.pcx"; // string CollCode = ""; //if (txtCollCode.Enabled != false) // CollCode = this.txtCollCode.Text; //else // CollCode = ViewState["CollCode"].ToString(); string CollName = this.txtCollName.Text; string OrgID = ddlOrgID.SelectedValue; string VillageCode = this.ddlVillageCode.SelectedValue; string MineOwner = this.txtMineOwner.Text; string MinePhone = this.txtMinePhone.Text; decimal YearOutput = decimal.Parse(this.txtYearOutput.Text); string CollState = this.ddlCollState.SelectedValue; string CollProperty = this.ddlCollProperty.SelectedValue;//煤矿属性 //税务企业工商营业执照 string ImageLicence = hidImageLicence.Value; // string LicenceImageType = this.txtLicenceImageType.Text; if (fupImageLicence.PostedFile.FileName != "") { string Licencepath = fupImageLicence.FileName; if (ImageLicence == "") { ImageLicence = Guid.NewGuid().ToString().Replace("-", ""); } string LicenceImageType = Licencepath.Substring(Licencepath.LastIndexOf(".") + 1);//后缀名 if (!strExtent.Contains("." + LicenceImageType.ToLower())) { MessageBox.Show(this.upDepartAdd, this, "税务企业工商营业执照只能为图片,请重新选择"); return; } } //税务登记证 string ImageRevenue = hidImageRevenue.Value; //string RevenueImageType = this.txtRevenueImageType.Text; if (fupImageRevenue.PostedFile.FileName != "") { string Revenuepath = fupImageRevenue.FileName; if (ImageRevenue == "") { ImageRevenue = Guid.NewGuid().ToString().Replace("-", ""); } string RevenueImageType = Revenuepath.Substring(Revenuepath.LastIndexOf(".") + 1);//后缀名 if (!strExtent.Contains("." + RevenueImageType.ToLower())) { MessageBox.Show(this.upDepartAdd, this, "税务登记证只能为图片,请重新选择"); return; } } //煤炭经营资格 string ImageCompetency = hidImageCompetency.Value; //string CompetencyImageType = this.txtCompetencyImageType.Text; if (fupImageCompetency.PostedFile.FileName != "") { string Competencypath = fupImageCompetency.FileName; if (ImageCompetency == "") { ImageCompetency = Guid.NewGuid().ToString().Replace("-", ""); } string CompetencyImageType = Competencypath.Substring(Competencypath.LastIndexOf(".") + 1);//后缀名 if (!strExtent.Contains("." + CompetencyImageType.ToLower())) { MessageBox.Show(this.upDepartAdd, this, "煤炭经营资格证只能为图片,请重新选择"); return; } } string Remark = this.txtRemark.Text; string IsForbid = this.ddlIsForbid.SelectedValue; //model.CollCode = CollCode; model.CollName = CollName; model.OrgCode = OrgID; model.VillageCode = VillageCode; model.MineOwner = MineOwner; model.MinePhone = MinePhone; model.YearOutput = YearOutput; model.CollState = CollState; model.CollProperty = CollProperty;//煤矿属性CollProperty model.ImageLicence = ImageLicence; model.ImageRevenue = ImageRevenue; model.ImageCompetency = ImageCompetency; model.Remark = Remark; model.IsForbid = IsForbid; if (strCustomer == "FuYuan") { model.ParcelCode = this.ddlParcel.SelectedValue; } else { model.ParcelCode = ""; } #endregion #region 将图片信息存放到实体中 //存储图片 List <IndustryPlatform.Model.Sys_FileSave> list = new List <IndustryPlatform.Model.Sys_FileSave>(); //税务企业工商营业执照 if (fupImageLicence.PostedFile.FileName != "") { file = new IndustryPlatform.Model.Sys_FileSave(); file.FileCode = ImageLicence; file.FileName = fupImageLicence.FileName; file.FileType = ""; file.FileContent = fupImageLicence.FileBytes; file.FilePath = ""; file.FileSize = 0; list.Add(file); } //税务登记证 if (fupImageRevenue.PostedFile.FileName != "") { file = new IndustryPlatform.Model.Sys_FileSave(); file.FileCode = ImageRevenue; file.FileName = fupImageRevenue.FileName; file.FileType = ""; file.FileContent = fupImageRevenue.FileBytes; file.FilePath = ""; file.FileSize = 0; list.Add(file); } //煤炭经营资格 if (fupImageCompetency.PostedFile.FileName != "") { file = new IndustryPlatform.Model.Sys_FileSave(); file.FileCode = ImageCompetency; file.FileName = fupImageCompetency.FileName; file.FileType = ""; file.FileContent = fupImageCompetency.FileBytes; file.FilePath = ""; file.FileSize = 0; list.Add(file); } #endregion if (Request.QueryString["CollID"] == null) { lock (this) { model.IsForbid = "0"; model.CollCode = DbHelperSQL.GetBaseMaxID("CollCode", "Sys_Colliery", "1=1"); if (bll.Add(model, list) == true) { #region 数据同步 try { //添加成功,数据同步到各个磅房 if (ConfigurationManager.AppSettings["IsSync"] == "1") { IndustryPlatform.DBUtility.MsmqManage msm = MsmqManage.GetMsmq(); string strSQL = "INSERT INTO Sys_Colliery ( " + "[CollCode] , " + "[CollName] , " + "[OrgCode] , " + "[VillageCode] , " + "[MineOwner] , " + "[MinePhone] , " + "[YearOutput] , " + "[CollState] , " + "[ImageLicence] , " + "[ImageRevenue] , " + "[ImageCompetency] , " + "[Remark] , " + "[CollProperty] , " + "[IsForbid],ParcelCode ) VALUES ('" + model.CollCode + "','" + IndustryPlatform.DBUtility.CommonMethod.RepChar(model.CollName) + "','" + model.OrgCode + "','" + model.VillageCode + "','" + model.MineOwner + "','" + model.MinePhone + "'," + model.YearOutput + ",'" + model.CollState + "','" + model.ImageLicence + "','" + model.ImageRevenue + "','" + model.ImageCompetency + "','" + IndustryPlatform.DBUtility.CommonMethod.RepChar(model.Remark) + "','" + model.CollProperty + "','" + model.IsForbid + "','" + model.ParcelCode + "') "; strSQL += ";insert into TT_ColieryAccount(CollCode) values ('" + model.CollCode + "')"; strSQL = msm.AllStation + msm.Prefix + "Sys_Colliery" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } //图片信息不用下发 //foreach (IndustryPlatform.Model.Sys_FileSave fileSave in list) //{ // strSQL = "INSERT INTO Sys_FileSave ( " + // "[FileCode] , " + // "[FileName] , " + // "[FilePath] , " + // "[FileSize] , " + // "[FileType] , " + // "[FileContent] ) VALUES ('" + fileSave.FileCode + "','" + fileSave.FileName + // "','" + fileSave.FilePath + "'," + fileSave.FileSize + // ",'" + fileSave.FileType + "','" + fileSave.FileContent + "')"; // strSQL = msm.AllStation + msm.Prefix + "Sys_FileSave" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; // msm.AddMsmq(strSQL); //} } catch { } #endregion ShowInfo(); ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('添加成功!');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('添加失败!');", true); } } } else { model.CollCode = Request.QueryString["CollID"].ToString(); if (bll.update(model, list) == true) { #region 数据同步 try { //添加成功,数据同步到各个磅房 if (ConfigurationManager.AppSettings["IsSync"] == "1") { IndustryPlatform.DBUtility.MsmqManage msm = IndustryPlatform.DBUtility.MsmqManage.GetMsmq(); string strSQL = "Delete From Sys_Colliery Where CollCode='" + model.CollCode + "';"; strSQL += "INSERT INTO Sys_Colliery ( " + "[CollCode] , " + "[CollName] , " + "[OrgCode] , " + "[VillageCode] , " + "[MineOwner] , " + "[MinePhone] , " + "[YearOutput] , " + "[CollState] , " + "[ImageLicence] , " + "[ImageRevenue] , " + "[ImageCompetency] , " + "[Remark] , " + "[CollProperty] , " + "[IsForbid],ParcelCode ) VALUES ('" + model.CollCode + "','" + IndustryPlatform.DBUtility.CommonMethod.RepChar(model.CollName) + "','" + model.OrgCode + "','" + model.VillageCode + "','" + model.MineOwner + "','" + model.MinePhone + "'," + model.YearOutput + ",'" + model.CollState + "','" + model.ImageLicence + "','" + model.ImageRevenue + "','" + model.ImageCompetency + "','" + IndustryPlatform.DBUtility.CommonMethod.RepChar(model.Remark) + "','" + model.CollProperty + "','" + model.IsForbid + "','" + model.ParcelCode + "') "; strSQL = msm.AllStation + msm.Prefix + "Sys_Colliery" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; msm.AddMsmq(strSQL); } //图片信息不用下发 //foreach (IndustryPlatform.Model.Sys_FileSave fileSave in list) //{ // strSQL = "INSERT INTO Sys_FileSave ( " + // "[FileCode] , " + // "[FileName] , " + // "[FilePath] , " + // "[FileSize] , " + // "[FileType] , " + // "[FileContent] ) VALUES ('" + fileSave.FileCode + "','" + fileSave.FileName + // "','" + fileSave.FilePath + "'," + fileSave.FileSize + // ",'" + fileSave.FileType + "','" + fileSave.FileContent + "')"; // strSQL = msm.AllStation + msm.Prefix + "Sys_FileSave" + msm.Prefix + msm.AddFlg + msm.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + msm.Prefix + strSQL; // msm.AddMsmq(strSQL); //} } catch { } #endregion ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "top.currForm.close();", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "alert('修改失败!');", true); } } }