protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["operid"])) { operid = Request.QueryString["operid"].ToString(); if (!operid.Contains(',')) { strOperatePostions = operbll.GetPosi(Convert.ToInt32(operid)); } } if (CookieManager.GetCookieValue("orgID") != null) { ViewState["SEQ"] = position.Getresult("orgSEQ", "SYS_Organization", "OrgCode=" + CookieManager.GetCookieValue("orgID").ToString()); // DataTree(CookieManager.GetCookieValue("orgID").ToString()); DBind(CookieManager.GetCookieValue("orgID").ToString(), "", ""); } else { // DataTree("0"); } } //Response.Write(operid.ToString()); }
private CustomToken GetTokenFromCookie() { CustomToken token = new CustomToken { AccessToken = _cookieManager.GetCookieValue("access_token"), RefreshToken = _cookieManager.GetCookieValue("refresh_token"), TokenType = "Bearer" }; TokenCredentialType type = TokenCredentialType.Auth; Enum.TryParse(_cookieManager.GetCookieValue("token_type"), out type); token.tokenCredentialType = type; return(token); }
protected void Page_Load(object sender, EventArgs e) { txt_username.Focus(); if (!Page.IsPostBack) { if (CookieManager.GetCookieValue("uid").ToString() != "0") { string strSeq = ""; IndustryPlatform.Model.SYS_Organization mOrg = new IndustryPlatform.BLL.SYS_Organization().GetModel(CookieManager.GetCookieValue("orgID").ToString()); if (mOrg != null) { strSeq = mOrg.OrgSeq; } else { strSeq = "-"; } ControlBindHelper.DropDownListBind(this.ddl_position, "SYS_Position", "PositionName", "PositionCode", "IsForbid='0' ", "请选择职位", "0"); } else { ControlBindHelper.DropDownListBind(this.ddl_position, "SYS_Position", "PositionName", "PositionCode", "IsForbid='0'", "请选择职位", "0"); } this.hf_where.Value = " 1=1 "; DBind(); } }
void setHtml() { string strSql = ""; if (CookieManager.GetCookieValue("uid") == "0") { strSql = "select top 5 menuID,menuName,IcValue,MenuUrl from SYS_MENU where IcValue<>'' and RootID='" + CookieManager.GetCookieValue("Sys") + "'"; } else { strSql = "select top 5 menuID,menuName,IcValue,MenuUrl from SYS_MENU where IcValue<>''" + "and menuID in (select distinct menuID from SYS_menuPosition where PositionCode in(" + CookieManager.GetCookieValue("PositionCode") + ")) and RootID='" + CookieManager.GetCookieValue("Sys") + "'"; } DataTable dt = DbHelperSQL.TQuery(strSql); if (dt.Rows.Count > 0) { string strImg = "<tr>"; string strText = "<tr>"; for (int i = 0; i < dt.Rows.Count; i++) { string strJs = "javascript:setTitleAndUrl(' " + dt.Rows[i]["MenuName"].ToString() + "','" + dt.Rows[i]["MenuUrl"].ToString() + "');"; strImg += "<td style=\"width:150px\" align=\"center\">" + "<a href=\"" + strJs + "\"><img src=\"Images/Default/" + dt.Rows[i]["IcValue"].ToString() + "\" /> </a>" + "</td>"; strText += "<td style=\"width:150px\" align=\"center\">" + "<a href=\"" + strJs + "\">" + dt.Rows[i]["MenuName"].ToString() + "</a>" + "</td>"; } strImg += "</tr>"; strText += "</tr>"; strHtml = strImg + strText; } }
List <int> PositionCodes = new List <int>(); //职位编号可以为多项 protected void Page_Load(object sender, EventArgs e) { txt_MenuName.Focus(); if (string.IsNullOrEmpty(CookieManager.GetCookieValue("PositionCode").ToString())) { return; } else { if (CookieManager.GetCookieValue("PositionCode").ToString() == "'0'") { PositionCodes.Add(0); } else { foreach (string PositionCode in CookieManager.GetCookieValue("PositionCode").ToString().Split(',')) { PositionCodes.Add(Convert.ToInt32(PositionCode)); } } } if (!IsPostBack) { //加载树 menuBll.BuildTree(tv_Menu, PositionCodes); //加载列表 LoadData(); } }
protected void Page_Load(object sender, EventArgs e) { //注册ajax strUrl = IndustryPlatform.Common.SystemConfig.StartUrl; OutScriptUrl();//输出js sysid = Request.QueryString["sysid"]; if (sysid == null || sysid == "") { sysid = "s0002"; } CookieManager.AppendCookie("Sys", sysid); if (!Page.IsPostBack) { IndustryPlatform.Model.SYS_MenuEntity menu = new IndustryPlatform.BLL.SYS_Menu().GetModel(sysid); if (menu != null) { this.lbSys.Text = menu.MenuName; } DataSet ds = new DataSet(); SYS_OperatorBll operbll = new SYS_OperatorBll(); ds = operbll.GetOperatorInfo(CookieManager.GetCookieValue("uid")); this.lbUserName.Text = ds.Tables[0].Rows[0]["UserName"].ToString(); BindTree(sysid); } }
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, "修改失败!"); } }
private void DataTree() { SYS_Dictionary dic = new SYS_Dictionary(); string strWhere = "1=1"; if (CookieManager.GetCookieValue("uid") != "0") { strWhere = "IsCanEdit='1'"; } DataSet ds = dic.GetDictionaryType(strWhere); if (ds != null) { //绑定树 foreach (DataRow row in ds.Tables[0].Rows) { TreeNode node = new TreeNode(); node.Text = row["businTypeName"].ToString(); node.Value = row["businTypeID"].ToString(); tvDictionaryType.Nodes.Add(node); } } else { //加载数据失败 } }
public ActionResult Entrar(string returnUrl, string alertSuccess) { if (Request.IsAjaxRequest()) { ViewBag.ReturnUrl = returnUrl; return(View("_Relogar")); } if (ControladorDeSessao.EstaAutenticado()) { return(RedirectToAction("Index", "Home")); } var cookieValue = CookieManager.GetCookieValue("lembrarme"); if (!string.IsNullOrWhiteSpace(cookieValue)) { ViewBag.Usuario = cookieValue; ViewBag.Checked = "checked=checked"; } ViewBag.AlertSuccess = alertSuccess; return(View()); }
List <int> PositionCodes = new List <int>(); //职位编号可以为多项 protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(CookieManager.GetCookieValue("PositionCode").ToString())) { return; } else { if (CookieManager.GetCookieValue("PositionCode").ToString() != "'0'") { foreach (string PositionCode in CookieManager.GetCookieValue("PositionCode").ToString().Split(',')) { PositionCodes.Add(Convert.ToInt32(PositionCode)); } } else { PositionCodes.Add(0); } } if (!IsPostBack) { this.txtMenuName.Focus(); menuBll.BindDdl(ddlParents, PositionCodes); SetText(); } }
//禁用 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); } }
public void OperInfoBind(string strid) { if (CookieManager.GetCookieValue("uid").ToString() != "0") { IndustryPlatform.Model.SYS_Organization m = bll.GetModel(CookieManager.GetCookieValue("orgID")); strSeq = m.OrgSeq; pid = m.ParentOrgCode.ToString(); string strOrgType = m.OrgType; if (strOrgType == "1") { lblTypeCode.Text = "选择磅房:"; ControlBindHelper.DropDownListBind(this.ddl_TypeCode, "TT_Room", "RoomName", "RoomCode", "IsForbid='0'", "请选择磅房", ""); } else if (strOrgType == "2") { lblTypeCode.Text = "选择煤矿:"; ControlBindHelper.DropDownListBind(this.ddl_TypeCode, "Sys_Colliery", "CollName", "CollCode", "IsForbid='0'", "请选择煤矿", ""); } if (strOrgType == "1" || strOrgType == "2") { this.ddl_TypeCode.Visible = true; tdTypeCode.Visible = true; } else { this.ddl_TypeCode.Visible = false; this.ddl_TypeCode.Items.Clear(); this.ddl_TypeCode.Items.Add(new ListItem("1", "")); } } bll.OrgDllBind(this.ddl_parentOrgID, strSeq, pid); DataSet ds = new DataSet(); ds = operbll.GetOperatorInfo(strid); this.rblist_sex.Items.FindByValue(ds.Tables[0].Rows[0]["Gender"].ToString()).Selected = true; this.txt_address.Text = ds.Tables[0].Rows[0]["Address"].ToString(); //this.rblist_local.Items.FindByValue(ds.Tables[0].Rows[0]["isLocal"].ToString()).Selected = true; this.txt_mobile.Text = ds.Tables[0].Rows[0]["MobileNo"].ToString(); this.txt_email.Text = ds.Tables[0].Rows[0]["Email"].ToString(); this.ddl_parentOrgID.SelectedValue = ds.Tables[0].Rows[0]["OrgCode"].ToString(); ddl_parentOrgID_SelectedIndexChanged(null, null); if (ddl_TypeCode.Visible) { ddl_TypeCode.SelectedValue = ds.Tables[0].Rows[0]["TypeCode"].ToString(); } this.txt_tel.Text = ds.Tables[0].Rows[0]["Tel"].ToString(); this.txt_pid.Text = ds.Tables[0].Rows[0]["PID"].ToString(); this.txt_username.Text = ds.Tables[0].Rows[0]["UserName"].ToString(); this.zipcode.Text = ds.Tables[0].Rows[0]["ZipCode"].ToString(); }
//public void DBind(string OrgID, string strname) //{ // //position.GridViewPagerBind(this.anp_oper, "SYS_Operator", "operatorID", "", "operatorID", this.gv_oper); // position.GridViewPagerBindbyRowNumber(this.anp_Org, " SYS_Position as p left join SYS_Organization as o on o.orgID=p.orgID ", "PositonID", OrgID, strname, "PositonID desc", this.gdv_Org); //} public void DBind(string OrgID, string strname, string OrgName) { if (CookieManager.GetCookieValue("uid").ToString() == "0") { ControlBindHelper.GridViewPagerBindByRowNum(this.anp_Org, "SYS_Position", "IsForbid='0'", " PositionName ", this.gdv_Org); } else { ControlBindHelper.GridViewPagerBindByRowNum(this.anp_Org, "SYS_Position", "IsForbid='0' ", " PositionName ", this.gdv_Org); } }
//启用 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(); }
string GetUserName() { CookieManager cm = new CookieManager(); if (null != Request.Cookies["UserName"]) { //return Request.Cookies["UserName"].ToString(); return cm.GetCookieValue("UserName"); } else { return ""; } }
public bool SetCollRunCoalKind(string strCollieryID, List <string> list) { try { List <string> listSql = new List <string>(); List <SqlParameter[]> listParm = new List <SqlParameter[]>(); listSql.Add("delete TT_CollRunCoalKind where CollCode=" + strCollieryID); listParm.Add(null); foreach (string strKindCode in list) { listSql.Add("insert into TT_CollRunCoalKind(CollCode,CoalKindCode) values(" + strCollieryID + "," + strKindCode + ")"); listParm.Add(null); } if (System.Configuration.ConfigurationManager.AppSettings["IsAddLog"] == "1") { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Sys_OperateLog("); strSql.Append("LogID,LogType,OperateTable,Operator,OperateDate,OperateIP,RelationID,Remark)"); strSql.Append(" values ("); strSql.Append("@LogID,@LogType,@OperateTable,@Operator,CONVERT(varchar,getdate(),120),@OperateIP,@RelationID,@Remark)"); SqlParameter[] parameters1 = { new SqlParameter("@LogID", SqlDbType.VarChar, 32), new SqlParameter("@LogType", SqlDbType.NVarChar, 18), new SqlParameter("@OperateTable", SqlDbType.VarChar, 32), new SqlParameter("@Operator", SqlDbType.NVarChar, 50), new SqlParameter("@OperateIP", SqlDbType.Char, 18), new SqlParameter("@RelationID", SqlDbType.Char, 32), new SqlParameter("@Remark", SqlDbType.NVarChar, 200) }; parameters1[0].Value = Guid.NewGuid().ToString().Replace("-", ""); parameters1[1].Value = "设置煤矿经营煤种"; parameters1[2].Value = "TT_CollRunCoalKind"; parameters1[3].Value = Convert.ToDecimal(CookieManager.GetCookieValue("uid")); parameters1[4].Value = HttpContext.Current.Request.UserHostAddress;; parameters1[5].Value = strCollieryID.ToString(); parameters1[6].Value = ""; listSql.Add(strSql.ToString()); listParm.Add(parameters1); } return(DbHelperSQL.ExecuteSqlCake(listSql, listParm)); } catch { return(false); } }
public void OrgTreeBind(TreeView tv) { tv.Nodes.Clear(); if (CookieManager.GetCookieValue("uid") != "0") { IndustryPlatform.Model.SYS_Organization m = GetModel(CookieManager.GetCookieValue("orgID")); TreeNode n = new TreeNode(m.OrgName, m.OrgCode); tv.Nodes.Add(n); OrgTreeBind(m.OrgCode, n, tv); } else { OrgTreeBind("-1", (TreeNode)null, tv); } tv.ExpandAll(); }
protected string getWhere() { StringBuilder sb_where = new StringBuilder(); string strWhere = " 1=1"; if (CookieManager.GetCookieValue("uid") != "0") { strWhere = "IsCanEdit='1'"; } sb_where.Append(strWhere); if (tvDictionaryType.SelectedNode != null) { sb_where.Append(" and businTypeID=" + tvDictionaryType.SelectedNode.Value + " "); } return(sb_where.ToString()); }
private void findData() { string strWhere = " 1=1"; if (CookieManager.GetCookieValue("uid").ToString() != "0") { strWhere += " and orgSEQ like '" + ViewState["SEQ"].ToString() + "%'"; } if (this.txt_orgCode.Text.Trim() != "") { strWhere += " and orgCode like '%" + this.txt_orgCode.Text.Trim().Replace("'", "''") + "%'"; } if (this.ddl_orgName.SelectedIndex != 0) { string strSEQ = bll.GetModel(this.ddl_orgName.SelectedValue).OrgSeq; strWhere += " and orgSEQ like '" + strSEQ + "%'"; } ControlBindHelper.GridViewPagerBindByRowNum(anp_Org, "VSys_Organization", strWhere, "IsForbid asc,OrgCode desc", this.gdv_Org); }
protected void Page_Load(object sender, EventArgs e) { txt_orgCode.Focus(); if (!IsPostBack) { if (CookieManager.GetCookieValue("uid").ToString() != "0") { IndustryPlatform.Model.SYS_Organization m = bll.GetModel(CookieManager.GetCookieValue("orgID")); ViewState["SEQ"] = m.OrgSeq; ViewState["pid"] = m.ParentOrgCode; } else { ViewState["SEQ"] = ""; ViewState["pid"] = 0; } lk_Click(sender, e); } }
private void BindTree(string SysCode) { string strSql = ""; if (CookieManager.GetCookieValue("uid") != "0") //非超级管理员用户 { strSql = "select * from SYS_MENU where menuID in(select distinct menuID from SYS_menuPosition where PositionCode in(" + CookieManager.GetCookieValue("PositionCode") + ")) Order by displayOrder"; } else { strSql = "select * from SYS_MENU Order by displayOrder"; } DataSet DS = DbHelperSQL.DQuery(strSql); DataTable dt = DS.Tables[0]; DataView dv = new DataView(dt); dv.RowFilter = " parentsID ='" + sysid + "' "; foreach (DataRowView drv in dv) { TreeNode node = new TreeNode(); node.Text = drv["menuName"].ToString(); node.Value = drv["menuID"].ToString(); node.ImageUrl = "Images/icons/openroomiconinfo.gif"; node.SelectAction = TreeNodeSelectAction.Expand; //根据测试需求加的 //node.NavigateUrl = drv["menuAction"].ToString(); //if ("0" == drv["IsPop"].ToString()) //{ // node.NavigateUrl = "javascript:setTitleAndUrl('" + node.Text + "','" + drv["menuAction"].ToString() + "');"; //} //else //{ // node.NavigateUrl = "javascript:window.open('" + drv["menuAction"].ToString() + "');"; //} node.Expanded = false; this.TreeView1.Nodes.Add(node); AddReplies(dt, node); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.txt_OrgName.Focus(); if (CookieManager.GetCookieValue("uid").ToString() != "0") { IndustryPlatform.Model.SYS_Organization m = bll.GetModel(CookieManager.GetCookieValue("orgID")); ViewState["SEQ"] = m.OrgSeq; ViewState["pid"] = m.ParentOrgCode; } else { ViewState["SEQ"] = ""; ViewState["pid"] = "0"; } bll.OrgDllBind(this.ddl_parentOrgID, ViewState["SEQ"].ToString(), ViewState["pid"].ToString()); ControlBindHelper.DropDownListBind(this.ddlOrgType, "Sys_Dictionary", "BusinName", "BusinID", "BusinTypeID='1014' and IsForbid='0'", "请选择部门类型", ""); SetText(); } }
public void DBind() { if (CookieManager.GetCookieValue("uid").ToString() != "0") { string strSeq = ""; IndustryPlatform.Model.SYS_Organization mOrg = new IndustryPlatform.BLL.SYS_Organization().GetModel(CookieManager.GetCookieValue("orgID").ToString()); if (mOrg != null) { strSeq = mOrg.OrgSeq; } else { strSeq = "-"; } ControlBindHelper.GridViewPagerBindByRowNum(this.anp_oper, "VSYS_Operator", this.hf_where.Value.ToString(), "IsForbid asc,UserCode desc", this.gv_oper); } else { ControlBindHelper.GridViewPagerBindByRowNum(this.anp_oper, "VSYS_Operator", this.hf_where.Value.ToString(), "IsForbid asc,UserCode desc", this.gv_oper); } }
public int AddColieryAccount(string strCollieryID, string strlowACCOUNT) { List <string> listSql = new List <string>(); List <SqlParameter[]> listParm = new List <SqlParameter[]>(); string strsql = "insert into TT_ColieryAccount (CollCode,lowACCOUNT) values (" + strCollieryID + "," + strlowACCOUNT + ")"; listSql.Add(strsql); listParm.Add(null); if (System.Configuration.ConfigurationManager.AppSettings["IsAddLog"] == "1") { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Sys_OperateLog("); strSql.Append("LogID,LogType,OperateTable,Operator,OperateDate,OperateIP,RelationID,Remark)"); strSql.Append(" values ("); strSql.Append("@LogID,@LogType,@OperateTable,@Operator,CONVERT(varchar,getdate(),120),@OperateIP,@RelationID,@Remark)"); SqlParameter[] parameters1 = { new SqlParameter("@LogID", SqlDbType.VarChar, 32), new SqlParameter("@LogType", SqlDbType.NVarChar, 18), new SqlParameter("@OperateTable", SqlDbType.VarChar, 32), new SqlParameter("@Operator", SqlDbType.NVarChar, 50), new SqlParameter("@OperateIP", SqlDbType.Char, 18), new SqlParameter("@RelationID", SqlDbType.Char, 32), new SqlParameter("@Remark", SqlDbType.NVarChar, 200) }; parameters1[0].Value = Guid.NewGuid().ToString().Replace("-", ""); parameters1[1].Value = "煤矿最低余额设置"; parameters1[2].Value = "TT_ColieryAccount"; parameters1[3].Value = CookieManager.GetCookieValue("UserName"); parameters1[4].Value = HttpContext.Current.Request.UserHostAddress;; parameters1[5].Value = strCollieryID.ToString(); parameters1[6].Value = "将煤矿最低余额设置为:" + strlowACCOUNT; listSql.Add(strSql.ToString()); listParm.Add(parameters1); } return(DbHelperSQL.ExecuteSqlCake(listSql, listParm) == true ? 1 : 0); }
private bool IsForceReset() { bool result = false; string sessionResetedRefreshToken = _sessionService.GetResetedRefreshToken(); //if no session if (sessionResetedRefreshToken == null) { //check if it is in the cookie CookieManager cookieManager = new CookieManager(_httpContextAccessor); if (cookieManager.GetCookieValue("resetedRefreshToken") != Settings.ResetedRefreshToken) { result = true; } } else if (sessionResetedRefreshToken != Settings.ResetedRefreshToken) { result = true; } return(result); }
private bool IsForceReset(ActionExecutingContext filterContext) { string value = "1"; bool result = false; string sessionResetedRefreshToken = _sessionService.GetResetedRefreshToken(); //if no session if (sessionResetedRefreshToken == null) { //check if it is in the cookie if (CookieManager.GetCookieValue("resetedRefreshToken") != value) { result = true; } } else if (sessionResetedRefreshToken != value) { result = true; } return(result); }
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 ibnLogin_Click(object sender, ImageClickEventArgs e) { //判断是否输入为空 if (this.txt_name.Text == "") { MessageBox.Show(Page, "请输入用户名!"); } if (this.txtPassword.Text == "") { MessageBox.Show(Page, "请输入密码!"); } //存储验证码 string strCookCode = CookieManager.GetCookieValue("CookCode"); if (txtCheckCode.Text.Trim() != "" && strCookCode != "") { if (txtCheckCode.Text.Trim().ToUpper() != strCookCode.ToUpper()) { MessageBox.Show(this.Page, "您输入的验证码不正确!"); txtCheckCode.Text = ""; return; } } else { MessageBox.Show(this.Page, "请输入验证码!"); txtCheckCode.Text = ""; return; } SYS_OperatorBll operbll = new SYS_OperatorBll(); DataSet ds = operbll.OperatorLogin(this.txt_name.Text.ToString(), CommonMethod.MD5Crypt(this.txtPassword.Text.ToString())); if (ds.Tables[0].Rows.Count > 0) { Session["uid"] = ds.Tables[0].Rows[0]["UserCode"].ToString(); CookieManager.AppendCookie("uid", ds.Tables[0].Rows[0]["UserCode"].ToString()); Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); CookieManager.AppendCookie("UserName", ds.Tables[0].Rows[0]["UserName"].ToString()); //所属部门 Session["orgID"] = ds.Tables[0].Rows[0]["OrgCode"].ToString(); CookieManager.AppendCookie("orgID", ds.Tables[0].Rows[0]["OrgCode"].ToString()); //所属于部门下的职位,一个人只属于一个部门,但可有多个职位,Session["PostionID"]保存的数据格式为数字 //和逗号组成的字符串 Session["PositionCode"] = operbll.GetPosi(Convert.ToInt32(Session["uid"])); CookieManager.AppendCookie("PositionCode", operbll.GetPosi(Convert.ToInt32(Session["uid"]))); string strIP = System.Net.Dns.Resolve(System.Net.Dns.GetHostName()).AddressList[0].ToString(); StringBuilder sbSql = new StringBuilder(""); sbSql.Append("insert into Sys_OperateLog (LogType,OperateTable,Operator,OperateDate,OperateIP,Remark,SysCode,RelationID)"); sbSql.Append(" values('登录','Sys_Operator','" + ds.Tables[0].Rows[0]["UserName"].ToString() + "',getdate(),'" + strIP + "','登录调运BS系统','s1000','')"); DbHelperSQL.ExecuteSql(sbSql.ToString()); Response.Redirect("index.aspx?sysid=" + IndustryPlatform.Common.SystemConfig.SysID, true); } else { MessageBox.Show(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) { 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, "修改失败!"); } } }