public UsersOR selectARowDateByGuid(string m_id) { string sql = string.Format("select * from T_SYS_USERS where GUID='{0}'", m_id); DataTable dt = null; try { dt = db.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } if (dt == null) return null; if (dt.Rows.Count == 0) return null; DataRow dr = dt.Rows[0]; UsersOR m_User = new UsersOR(dr); return m_User; }
public UsersOR sp_UserLogin(string userID, string UsrPwd) { string sql = string.Format("select * from T_SYS_USERS where LOGON_NAME='{0}' and USER_PWD='{1}'", userID, UsrPwd); DataTable dt = null; try { dt = db.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } if (dt == null) return null; if (dt.Rows.Count == 0) { UsersOR user = this.selectARowDate(userID); if (user != null) throw new Exception("密码错误!"); else throw new Exception("用户名或密码错误!"); } DataRow dr = dt.Rows[0]; UsersOR m_User = new UsersOR(dr); OrganizationsOR org = new OrganizationsDA().selectARowDate(m_User.ParentGuid); if (org != null) { m_User.DepartmentName = org.DisplayName; } return m_User; }
public void updateUsers(UsersOR obj, string m_id) { updateUser(obj, m_id); }
/// <summary> /// ����T_SYS_USERS /// </summary> public bool updateUser(UsersOR T_SY, string m_id) { string sql = string.Format(@" update T_SYS_USERS set DISPLAY_NAME='{0}',ALL_PATH_NAME='{1}',RANK_NAME='{2}',DESCRIPTION='{3}',START_TIME='{4}',END_TIME='{5}',LOGON_NAME='{6}',IC_CARD='{7}',PWD_TYPE_GUID='{8}',USER_PWD='{9}',RANK_CODE='{10}',E_MAIL='{11}',POSTURAL={12},MODIFY_TIME=getdate(),AD_COUNT={13},PERSON_ID='{14}' where GUID='{15}'" , T_SY.DisplayName, T_SY.AllPathName, T_SY.RankName, T_SY.Description, T_SY.StartTime.ToString(), T_SY.EndTime.ToString(), T_SY.LogonName, T_SY.IcCard, T_SY.PwdTypeGuid, T_SY.UserPwd, T_SY.RankCode, T_SY.EMail, T_SY.Postural, T_SY.AdCount, T_SY.PersonId, m_id); try { db.ExecuteNoQuery(sql); } catch (Exception ex) { throw ex; } return true; }
public UsersOR selectSingleUserByID(string m_ID) { string sql = string.Format("select * from T_SYS_USERS where GUID='{0}'", m_ID); DataTable dt = null; try { dt = db.ExecuteQuery(sql); } catch (Exception ex) { throw ex; } if (dt == null) return null; if (dt.Rows.Count == 0) return null; DataRow dr = dt.Rows[0]; UsersOR m_User = new UsersOR(dr); return m_User; }
public void insertUser(UsersOR obj) { OrganizationsOR orgparent = selectSingleOrganization(obj.ParentGuid); DataTable dtUser = GetUsersByParentID(obj.ParentGuid); int counter = (dtUser == null ? 0 : dtUser.Rows.Count); bool sortIsExis = true; while (sortIsExis) { obj.InnerSort = getOrgSort(++counter);//�����ڲ������ sortIsExis = OrgSortIsExis(obj.InnerSort, obj.ParentGuid); } obj.OriginalSort = orgparent.OriginalSort + obj.InnerSort;//��ϵͳ�е�ȫ��ַ����������������־���ڲ��ŵ�·����ϵ�� insertU(obj); }
/// ����T_SYS_USERS /// </summary> public bool insertU(UsersOR T_SY) { string sql = string.Format(@" insert into T_SYS_USERS (GUID,PARENT_GUID,DISPLAY_NAME,INNER_SORT,ORIGINAL_SORT,ALL_PATH_NAME,STATUS,RANK_NAME,DESCRIPTION,START_TIME,END_TIME,LOGON_NAME,IC_CARD,PWD_TYPE_GUID,USER_PWD,RANK_CODE,E_MAIL,POSTURAL,CREATE_TIME,MODIFY_TIME,AD_COUNT,PERSON_ID) values(newid(),'{0}','{1}','{2}','{3}','{4}',1,'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),getdate(),'{16}','{17}')" , T_SY.ParentGuid, T_SY.DisplayName, T_SY.InnerSort, T_SY.OriginalSort, T_SY.AllPathName, T_SY.RankName, T_SY.Description, T_SY.StartTime.ToString(), T_SY.EndTime.ToString(), T_SY.LogonName, T_SY.IcCard, T_SY.PwdTypeGuid, T_SY.UserPwd, T_SY.RankCode, T_SY.EMail, T_SY.Postural, T_SY.AdCount, T_SY.PersonId); try { db.ExecuteNoQuery(sql); } catch (Exception ex) { throw ex; } return true; }
private UsersOR setValue() { UsersOR m_User = new UsersOR(); if (Request.QueryString["GUID"] == null) { m_User.Guid = Guid.NewGuid().ToString(); } else { string m_id = Request.QueryString["GUID"].ToString(); m_User.Guid = m_id; } //if (Request.QueryString["opType"].ToString() == "alert") // m_User.GUID = txtGuid.Text;//用户身份标志ID m_User.ParentGuid = Request.QueryString["parentGUID"].ToString();//所在部门的标志ID m_User.DisplayName = txtDisplayName.Text;//用户的显示名称 //m_User.InnerSort = txtInnerSort.Text;//用户在部门中的排序 //m_User.OriginalSort = txtOriginalSort.Text;//用户在系统中的全地址(不用于排序,仅仅标志所在部门的路径关系) m_User.AllPathName = txtAllPathName.Text;//用户在系统中的全程文字表述(例如:全国海关\海关总署\信息中心\应用开发二处\朱佳炜) m_User.Status = 1;// int.Parse(txtStatus.Text);//状态(1、正常使用;2、直接逻辑删除;4、机构级联逻辑删除;8、人员级联逻辑删除;)掩码方式实现 m_User.RankName = txtRankName.Text;//用户在该部门中的职位 m_User.Description = txtDescription.Text;//用户的附加描述信息 m_User.StartTime = txtStartTime.Text;//关系启用时间 m_User.EndTime = txtEndTime.Text;//关系结束时间 m_User.LogonName = txtLogonName.Text;//用户的登录名称 m_User.IcCard = txtIcCard.Text;//用户的IC卡号 m_User.UserPwd = txtUserPwd.Text;//用户所使用的密码(加密存储) m_User.RankCode = dpdRankCode.Text;//行政级别信息数据 m_User.EMail = txtEMail.Text;//用户默认使用的EMAIL //m_User.POSTURAL = int.Parse(txtPostural.Text);//用户的在系统中的状态(1、禁用状态;2、要求下次登录修改密码;4、正常使用;)掩码方式实现 //m_User. = DateTime.Parse(txtCreateTime.Text);//创建时间 //m_User.MODIFY_TIME = DateTime.Now;//.Parse(txtModifyTime.Text);//最近修改时间 // m_User.AdCount = int.Parse(txtAdCount.Text);//是否在AD中建立对应的账号 m_User.PersonId = txtPersonId.Text;//海关人员编码 return m_User; }