/// <summary> /// 将记录集转为sys_UserTable实体类 /// </summary> /// <param name="dr">记录集</param> /// <returns>sys_UserTable</returns> protected object Populatesys_User(IDataReader dr) { sys_UserTable nc = new sys_UserTable(); if (!Convert.IsDBNull(dr["UserID"])) nc.UserID = Convert.ToInt32(dr["UserID"]); // 用户ID号 if (!Convert.IsDBNull(dr["U_LoginName"])) nc.U_LoginName = Convert.ToString(dr["U_LoginName"]).Trim(); // 登陆名 if (!Convert.IsDBNull(dr["U_Password"])) nc.U_Password = Convert.ToString(dr["U_Password"]).Trim(); // 密码md5加密字符 if (!Convert.IsDBNull(dr["U_CName"])) nc.U_CName = Convert.ToString(dr["U_CName"]).Trim(); // 中文姓名 if (!Convert.IsDBNull(dr["U_EName"])) nc.U_EName = Convert.ToString(dr["U_EName"]).Trim(); // 英文名 if (!Convert.IsDBNull(dr["U_GroupID"])) nc.U_GroupID = Convert.ToInt32(dr["U_GroupID"]); // 部门ID号与sys_Group表中GroupID关联 if (!Convert.IsDBNull(dr["U_Email"])) nc.U_Email = Convert.ToString(dr["U_Email"]).Trim(); // 电子邮件 if (!Convert.IsDBNull(dr["U_Type"])) nc.U_Type = Convert.ToInt32(dr["U_Type"]); // 用户类型0:超级用户1:普通用户 if (!Convert.IsDBNull(dr["U_Status"])) nc.U_Status = Convert.ToInt32(dr["U_Status"]); // 当前状态0:正常 1:禁止 if (!Convert.IsDBNull(dr["U_Licence"])) nc.U_Licence = Convert.ToString(dr["U_Licence"]).Trim(); // 用户序列号 if (!Convert.IsDBNull(dr["U_Mac"])) nc.U_Mac = Convert.ToString(dr["U_Mac"]).Trim(); // 锁定机器硬件地址 if (!Convert.IsDBNull(dr["U_Remark"])) nc.U_Remark = Convert.ToString(dr["U_Remark"]).Trim(); // 备注说明 if (!Convert.IsDBNull(dr["U_IDCard"])) nc.U_IDCard = Convert.ToString(dr["U_IDCard"]).Trim(); // 身份证号码 if (!Convert.IsDBNull(dr["U_Sex"])) nc.U_Sex = Convert.ToInt32(dr["U_Sex"]); // 性别1:男0:女 if (!Convert.IsDBNull(dr["U_BirthDay"])) nc.U_BirthDay = Convert.ToDateTime(dr["U_BirthDay"]); // 出生日期 if (!Convert.IsDBNull(dr["U_MobileNo"])) nc.U_MobileNo = Convert.ToString(dr["U_MobileNo"]).Trim(); // 手机号 if (!Convert.IsDBNull(dr["U_UserNO"])) nc.U_UserNO = Convert.ToString(dr["U_UserNO"]).Trim(); // 员工编号 if (!Convert.IsDBNull(dr["U_WorkStartDate"])) nc.U_WorkStartDate = Convert.ToDateTime(dr["U_WorkStartDate"]); // 到职日期 if (!Convert.IsDBNull(dr["U_WorkEndDate"])) nc.U_WorkEndDate = Convert.ToDateTime(dr["U_WorkEndDate"]); // 离职日期 if (!Convert.IsDBNull(dr["U_CompanyMail"])) nc.U_CompanyMail = Convert.ToString(dr["U_CompanyMail"]).Trim(); // 公司邮件地址 if (!Convert.IsDBNull(dr["U_Title"])) nc.U_Title = Convert.ToInt32(dr["U_Title"]); // 职称与应用字段关联 if (!Convert.IsDBNull(dr["U_Extension"])) nc.U_Extension = Convert.ToString(dr["U_Extension"]).Trim(); // 分机号 if (!Convert.IsDBNull(dr["U_HomeTel"])) nc.U_HomeTel = Convert.ToString(dr["U_HomeTel"]).Trim(); // 家中电话 if (!Convert.IsDBNull(dr["U_PhotoUrl"])) nc.U_PhotoUrl = Convert.ToString(dr["U_PhotoUrl"]).Trim(); // 用户照片网址 if (!Convert.IsDBNull(dr["U_DateTime"])) nc.U_DateTime = Convert.ToDateTime(dr["U_DateTime"]); // 操作时间 if (!Convert.IsDBNull(dr["U_LastIP"])) nc.U_LastIP = Convert.ToString(dr["U_LastIP"]).Trim(); // 最后访问IP if (!Convert.IsDBNull(dr["U_LastDateTime"])) nc.U_LastDateTime = Convert.ToDateTime(dr["U_LastDateTime"]); // 最后访问时间 if (!Convert.IsDBNull(dr["U_ExtendField"])) nc.U_ExtendField = Convert.ToString(dr["U_ExtendField"]).Trim(); // 扩展字段 if (!Convert.IsDBNull(dr["SignPicture"])) nc.SignPicture = Convert.ToString(dr["SignPicture"]).Trim(); // SignPicture if (!Convert.IsDBNull(dr["SignPassword"])) nc.SignPassword = Convert.ToString(dr["SignPassword"]).Trim(); // SignPassword return nc; }
/// <summary> /// ��ʼ������ /// </summary> /// <param name="ut"></param> private void OnStartData(sys_UserTable ut) { #region "��ʾ����" U_LoginName_Value.Text = ut.U_LoginName; U_Password_Value.Text = "******"; U_Type_Value.Text = ut.U_Type == 0 ? "�����û�" : "��ͨ�û�"; U_Status_Value.Text = ut.U_Status == 0 ? "����" : "��ֹ"; U_UserNO_Value.Text = ut.U_UserNO; U_CName_Value.Text = ut.U_CName; U_EName_Value.Text = ut.U_EName; U_GroupID_Value.Text = BusinessFacade.sys_GroupDisp(ut.U_GroupID).G_CName; U_Sex_Value.Text = ut.U_Sex == 0 ? "Ů" : "��"; U_BirthDay_Value.Text = Common.ConvertDate(ut.U_BirthDay); U_Title_Value.Text = BusinessFacade.sys_FieldValueDisp(ut.U_Title).V_Text; U_IDCard_Value.Text = ut.U_IDCard; U_HomeTel_Value.Text = ut.U_HomeTel; U_MobileNo_Value.Text = ut.U_MobileNo; U_CompanyMail_Value.Text = ut.U_CompanyMail; U_Email_Value.Text = ut.U_Email; U_Extension_Value.Text = ut.U_Extension; U_WorkStartDate_Value.Text = Common.ConvertDate(ut.U_WorkStartDate); U_Remark_Value.Text = ut.U_Remark; if ((ut.U_PhotoUrl + "").Trim() != "") { U_PhotoUrl_Value.ImageUrl = Common.BuildDownFileUrl("UserPhoto/s_" + ut.U_PhotoUrl); MaxImgUrl = Common.BuildDownFileUrl("UserPhoto/" + ut.U_PhotoUrl); } else U_PhotoUrl_Value.Visible = false; U_LastIP_Value.Text = Common.GetIPLookUrl(ut.U_LastIP); U_LastDateTime_Value.Text = ut.U_LastDateTime.ToString(); #endregion #region "��������" U_LoginName.Text = ut.U_LoginName; U_Password.Attributes["value"] = ut.U_Password; ListItem li = U_Type.Items.FindByValue(ut.U_Type.ToString()); if (li != null) li.Selected = true; ListItem li1 = U_Status.Items.FindByValue(ut.U_Status.ToString()); if (li1 != null) li1.Selected = true; U_UserNO.Text = ut.U_UserNO; U_CName.Text = ut.U_CName; U_EName.Text = ut.U_EName; U_GroupID.Value = ut.U_GroupID.ToString(); U_GroupID_Txt.Value = BusinessFacade.sys_GroupDisp(ut.U_GroupID).G_CName; ListItem li2 = U_Sex.Items.FindByValue(ut.U_Sex.ToString()); if (li2 != null) li2.Selected = true; U_BirthDay.Text = Common.ConvertDate(ut.U_BirthDay); FieldWebControls1.Field_Value = ut.U_Title.ToString(); U_IDCard.Text = ut.U_IDCard; U_HomeTel.Text = ut.U_HomeTel; U_MobileNo.Text = ut.U_MobileNo; U_CompanyMail.Text = ut.U_CompanyMail; U_Email.Text = ut.U_Email; U_Extension.Text = ut.U_Extension; U_WorkStartDate.Text = Common.ConvertDate(ut.U_WorkStartDate); U_Remark.Text = ut.U_Remark; //if ((ut.U_PhotoUrl + "").Trim() != "") //{ // U_PhotoUrl_Value.ImageUrl = Common.BuildDownFileUrl("UserPhoto/s_" + ut.U_PhotoUrl); //} //else // U_PhotoUrl_Value.Visible = false; #endregion }
/// <summary> /// ����/ɾ��/�� sys_User /// </summary> /// <param name="fam">sys_UserTableʵ����</param> /// <returns>����0������</returns> public override int sys_UserInsertUpdate(sys_UserTable fam) { int rInt = 0; using (OracleConnection Conn = GetSqlConnection()) { string CommTxt; OracleCommand cmd = new OracleCommand(); cmd.Connection = Conn; if (fam.DB_Option_Action_ == "Insert") { CommTxt = "Insert into sys_User(UserID,U_LoginName,U_Password,U_CName,U_EName,U_GroupID,U_Email,U_Type,U_Status,U_Licence,U_Mac,U_Remark,U_IDCard,U_Sex,U_BirthDay,U_MobileNo,U_UserNO,U_WorkStartDate,U_WorkEndDate,U_CompanyMail,U_Title,U_Extension,U_HomeTel,U_PhotoUrl,U_DateTime,U_LastIP,U_LastDateTime,U_ExtendField)VALUES(SEQ_sys_User_ID.NEXTVAL,:U_LoginName,:U_Password,:U_CName,:U_EName,:U_GroupID,:U_Email,:U_Type,:U_Status,:U_Licence,:U_Mac,:U_Remark,:U_IDCard,:U_Sex,:U_BirthDay,:U_MobileNo,:U_UserNO,:U_WorkStartDate,:U_WorkEndDate,:U_CompanyMail,:U_Title,:U_Extension,:U_HomeTel,:U_PhotoUrl,:U_DateTime,:U_LastIP,:U_LastDateTime,:U_ExtendField)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("U_LoginName", OracleType.NVarChar).Value = fam.U_LoginName + ""; //��½�� cmd.Parameters.Add("U_Password", OracleType.VarChar).Value = fam.U_Password + ""; //����md5�����ַ� cmd.Parameters.Add("U_CName", OracleType.NVarChar).Value = fam.U_CName + ""; //�������� cmd.Parameters.Add("U_EName", OracleType.VarChar).Value = fam.U_EName + ""; //Ӣ���� cmd.Parameters.Add("U_GroupID", OracleType.Int32).Value = fam.U_GroupID; //����ID����sys_Group����GroupID���� cmd.Parameters.Add("U_Email", OracleType.VarChar).Value = fam.U_Email + ""; //�����ʼ� cmd.Parameters.Add("U_Type", OracleType.SByte).Value = fam.U_Type; //�û�����0:�����û�1:��ͨ�û� cmd.Parameters.Add("U_Status", OracleType.SByte).Value = fam.U_Status; //��ǰ״̬0:���� 1:��ֹ��½ 2:ɾ�� cmd.Parameters.Add("U_Licence", OracleType.VarChar).Value = fam.U_Licence + ""; //�û����к� cmd.Parameters.Add("U_Mac", OracleType.VarChar).Value = fam.U_Mac + ""; //��������Ӳ����ַ cmd.Parameters.Add("U_Remark", OracleType.NVarChar).Value = fam.U_Remark + ""; //��ע˵�� cmd.Parameters.Add("U_IDCard", OracleType.VarChar).Value = fam.U_IDCard + ""; //���֤���� cmd.Parameters.Add("U_Sex", OracleType.SByte).Value = fam.U_Sex; //�Ա�1:��0:Ů if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = fam.U_BirthDay; //�������� else cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = DBNull.Value; //�������� cmd.Parameters.Add("U_MobileNo", OracleType.VarChar).Value = fam.U_MobileNo + ""; //�ֻ��� cmd.Parameters.Add("U_UserNO", OracleType.VarChar).Value = fam.U_UserNO + ""; //Ա����� if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = fam.U_WorkStartDate; //��ְ���� else cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = DBNull.Value; //��ְ���� if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = fam.U_WorkEndDate; //��ְ���� else cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = DBNull.Value; //��ְ���� cmd.Parameters.Add("U_CompanyMail", OracleType.VarChar).Value = fam.U_CompanyMail + ""; //��˾�ʼ���ַ cmd.Parameters.Add("U_Title", OracleType.Int32).Value = fam.U_Title; //ְ����Ӧ���ֶι��� cmd.Parameters.Add("U_Extension", OracleType.VarChar).Value = fam.U_Extension + ""; //�ֻ��� cmd.Parameters.Add("U_HomeTel", OracleType.VarChar).Value = fam.U_HomeTel + ""; //���е绰 cmd.Parameters.Add("U_PhotoUrl", OracleType.NVarChar).Value = fam.U_PhotoUrl + ""; //�û���Ƭ��ַ cmd.Parameters.Add("U_DateTime", OracleType.DateTime).Value = fam.U_DateTime; //����ʱ�� cmd.Parameters.Add("U_LastIP", OracleType.VarChar).Value = fam.U_LastIP + ""; //������IP cmd.Parameters.Add("U_LastDateTime", OracleType.DateTime).Value = fam.U_LastDateTime; //������ʱ�� cmd.Parameters.Add("U_ExtendField", OracleType.VarChar).Value = fam.U_ExtendField + ""; //��չ�ֶ� } else if (fam.DB_Option_Action_ == "Update") { CommTxt = "UPDATE sys_User SET U_LoginName = :U_LoginName,U_Password = :U_Password,U_CName = :U_CName,U_EName = :U_EName,U_GroupID = :U_GroupID,U_Email = :U_Email,U_Type = :U_Type,U_Status = :U_Status,U_Licence = :U_Licence,U_Mac = :U_Mac,U_Remark = :U_Remark,U_IDCard = :U_IDCard,U_Sex = :U_Sex,U_BirthDay = :U_BirthDay,U_MobileNo = :U_MobileNo,U_UserNO = :U_UserNO,U_WorkStartDate = :U_WorkStartDate,U_WorkEndDate = :U_WorkEndDate,U_CompanyMail = :U_CompanyMail,U_Title = :U_Title,U_Extension = :U_Extension,U_HomeTel = :U_HomeTel,U_PhotoUrl = :U_PhotoUrl,U_DateTime = :U_DateTime,U_LastIP = :U_LastIP,U_LastDateTime = :U_LastDateTime,U_ExtendField = :U_ExtendField WHERE (UserID = :UserID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("U_LoginName", OracleType.NVarChar).Value = fam.U_LoginName + ""; //��½�� cmd.Parameters.Add("U_Password", OracleType.VarChar).Value = fam.U_Password + ""; //����md5�����ַ� cmd.Parameters.Add("U_CName", OracleType.NVarChar).Value = fam.U_CName + ""; //�������� cmd.Parameters.Add("U_EName", OracleType.VarChar).Value = fam.U_EName + ""; //Ӣ���� cmd.Parameters.Add("U_GroupID", OracleType.Int32).Value = fam.U_GroupID; //����ID����sys_Group����GroupID���� cmd.Parameters.Add("U_Email", OracleType.VarChar).Value = fam.U_Email + ""; //�����ʼ� cmd.Parameters.Add("U_Type", OracleType.SByte).Value = fam.U_Type; //�û�����0:�����û�1:��ͨ�û� cmd.Parameters.Add("U_Status", OracleType.SByte).Value = fam.U_Status; //��ǰ״̬0:���� 1:��ֹ��½ 2:ɾ�� cmd.Parameters.Add("U_Licence", OracleType.VarChar).Value = fam.U_Licence + ""; //�û����к� cmd.Parameters.Add("U_Mac", OracleType.VarChar).Value = fam.U_Mac + ""; //��������Ӳ����ַ cmd.Parameters.Add("U_Remark", OracleType.NVarChar).Value = fam.U_Remark + ""; //��ע˵�� cmd.Parameters.Add("U_IDCard", OracleType.VarChar).Value = fam.U_IDCard + ""; //���֤���� cmd.Parameters.Add("U_Sex", OracleType.SByte).Value = fam.U_Sex; //�Ա�1:��0:Ů if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = fam.U_BirthDay; //�������� else cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = DBNull.Value; //�������� cmd.Parameters.Add("U_MobileNo", OracleType.VarChar).Value = fam.U_MobileNo + ""; //�ֻ��� cmd.Parameters.Add("U_UserNO", OracleType.VarChar).Value = fam.U_UserNO + ""; //Ա����� if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = fam.U_WorkStartDate; //��ְ���� else cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = DBNull.Value; //��ְ���� if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = fam.U_WorkEndDate; //��ְ���� else cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = DBNull.Value; //��ְ���� cmd.Parameters.Add("U_CompanyMail", OracleType.VarChar).Value = fam.U_CompanyMail + ""; //��˾�ʼ���ַ cmd.Parameters.Add("U_Title", OracleType.Int32).Value = fam.U_Title; //ְ����Ӧ���ֶι��� cmd.Parameters.Add("U_Extension", OracleType.VarChar).Value = fam.U_Extension + ""; //�ֻ��� cmd.Parameters.Add("U_HomeTel", OracleType.VarChar).Value = fam.U_HomeTel + ""; //���е绰 cmd.Parameters.Add("U_PhotoUrl", OracleType.NVarChar).Value = fam.U_PhotoUrl + ""; //�û���Ƭ��ַ cmd.Parameters.Add("U_DateTime", OracleType.DateTime).Value = fam.U_DateTime; //����ʱ�� cmd.Parameters.Add("U_LastIP", OracleType.VarChar).Value = fam.U_LastIP + ""; //������IP cmd.Parameters.Add("U_LastDateTime", OracleType.DateTime).Value = fam.U_LastDateTime; //������ʱ�� cmd.Parameters.Add("U_ExtendField", OracleType.VarChar).Value = fam.U_ExtendField + ""; //��չ�ֶ� cmd.Parameters.Add("UserID", OracleType.Int32).Value = fam.UserID; } else if (fam.DB_Option_Action_ == "Delete") { CommTxt = "Delete from sys_User WHERE (UserID = :UserID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("UserID", OracleType.Int32).Value = fam.UserID; } else throw new ApplicationException("��ʶ��IJ�������!"); Conn.Open(); OracleTransaction Tran = Conn.BeginTransaction(); cmd.Transaction = Tran; try { rInt = cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); if (fam.DB_Option_Action_ == "Insert") { cmd.CommandText = "select SEQ_sys_User_ID.CURRVAL from dual"; rInt = Convert.ToInt32(cmd.ExecuteScalar()); } Tran.Commit(); } catch (Exception ex) { Tran.Rollback(); throw new ApplicationException(ex.ToString()); } finally { Tran.Dispose(); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } } return rInt; }
//#region "sys_User - DataProvider" ///// <summary> ///// 新增/删除/修改 sys_User ///// </summary> ///// <param name="fam">sys_UserTable实体类</param> ///// <returns>返回0操正常</returns> //public abstract int sys_UserInsertUpdate(sys_UserTable fam); ///// <summary> ///// 返回sys_UserTable实体类的ArrayList对象 ///// </summary> ///// <param name="qp">查询类</param> ///// <param name="RecordCount">返回记录总数</param> ///// <returns>sys_UserTable实体类的ArrayList对象</returns> //public abstract ArrayList sys_UserList(QueryParam qp, out int RecordCount); ///// <summary> ///// 将记录集转为sys_UserTable实体类 ///// </summary> ///// <param name="dr">记录集</param> ///// <returns>sys_UserTable</returns> //protected object Populatesys_User(IDataReader dr) //{ // sys_UserTable nc = new sys_UserTable(); // if (!Convert.IsDBNull(dr["UserID"])) nc.UserID = Convert.ToInt32(dr["UserID"]); // 用户ID号 // if (!Convert.IsDBNull(dr["U_LoginName"])) nc.U_LoginName = Convert.ToString(dr["U_LoginName"]).Trim(); // 登陆名 // if (!Convert.IsDBNull(dr["U_Password"])) nc.U_Password = Convert.ToString(dr["U_Password"]).Trim(); // 密码md5加密字符 // if (!Convert.IsDBNull(dr["U_CName"])) nc.U_CName = Convert.ToString(dr["U_CName"]).Trim(); // 中文姓名 // if (!Convert.IsDBNull(dr["U_EName"])) nc.U_EName = Convert.ToString(dr["U_EName"]).Trim(); // 英文名 // if (!Convert.IsDBNull(dr["U_GroupID"])) nc.U_GroupID = Convert.ToInt32(dr["U_GroupID"]); // 部门ID号与sys_Group表中GroupID关联 // if (!Convert.IsDBNull(dr["U_Email"])) nc.U_Email = Convert.ToString(dr["U_Email"]).Trim(); // 电子邮件 // if (!Convert.IsDBNull(dr["U_Type"])) nc.U_Type = Convert.ToInt32(dr["U_Type"]); // 用户类型0:超级用户1:普通用户 // if (!Convert.IsDBNull(dr["U_Status"])) nc.U_Status = Convert.ToInt32(dr["U_Status"]); // 当前状态0:正常 1:禁止 // if (!Convert.IsDBNull(dr["U_Licence"])) nc.U_Licence = Convert.ToString(dr["U_Licence"]).Trim(); // 用户序列号 // if (!Convert.IsDBNull(dr["U_Mac"])) nc.U_Mac = Convert.ToString(dr["U_Mac"]).Trim(); // 锁定机器硬件地址 // if (!Convert.IsDBNull(dr["U_Remark"])) nc.U_Remark = Convert.ToString(dr["U_Remark"]).Trim(); // 备注说明 // if (!Convert.IsDBNull(dr["U_IDCard"])) nc.U_IDCard = Convert.ToString(dr["U_IDCard"]).Trim(); // 身份证号码 // if (!Convert.IsDBNull(dr["U_Sex"])) nc.U_Sex = Convert.ToInt32(dr["U_Sex"]); // 性别1:男0:女 // if (!Convert.IsDBNull(dr["U_BirthDay"])) nc.U_BirthDay = Convert.ToDateTime(dr["U_BirthDay"]); // 出生日期 // if (!Convert.IsDBNull(dr["U_MobileNo"])) nc.U_MobileNo = Convert.ToString(dr["U_MobileNo"]).Trim(); // 手机号 // if (!Convert.IsDBNull(dr["U_UserNO"])) nc.U_UserNO = Convert.ToString(dr["U_UserNO"]).Trim(); // 员工编号 // if (!Convert.IsDBNull(dr["U_WorkStartDate"])) nc.U_WorkStartDate = Convert.ToDateTime(dr["U_WorkStartDate"]); // 到职日期 // if (!Convert.IsDBNull(dr["U_WorkEndDate"])) nc.U_WorkEndDate = Convert.ToDateTime(dr["U_WorkEndDate"]); // 离职日期 // if (!Convert.IsDBNull(dr["U_CompanyMail"])) nc.U_CompanyMail = Convert.ToString(dr["U_CompanyMail"]).Trim(); // 公司邮件地址 // if (!Convert.IsDBNull(dr["U_Title"])) nc.U_Title = Convert.ToInt32(dr["U_Title"]); // 职称与应用字段关联 // if (!Convert.IsDBNull(dr["U_Extension"])) nc.U_Extension = Convert.ToString(dr["U_Extension"]).Trim(); // 分机号 // if (!Convert.IsDBNull(dr["U_HomeTel"])) nc.U_HomeTel = Convert.ToString(dr["U_HomeTel"]).Trim(); // 家中电话 // if (!Convert.IsDBNull(dr["U_PhotoUrl"])) nc.U_PhotoUrl = Convert.ToString(dr["U_PhotoUrl"]).Trim(); // 用户照片网址 // if (!Convert.IsDBNull(dr["U_DateTime"])) nc.U_DateTime = Convert.ToDateTime(dr["U_DateTime"]); // 操作时间 // if (!Convert.IsDBNull(dr["U_LastIP"])) nc.U_LastIP = Convert.ToString(dr["U_LastIP"]).Trim(); // 最后访问IP // if (!Convert.IsDBNull(dr["U_LastDateTime"])) nc.U_LastDateTime = Convert.ToDateTime(dr["U_LastDateTime"]); // 最后访问时间 // if (!Convert.IsDBNull(dr["U_ExtendField"])) nc.U_ExtendField = Convert.ToString(dr["U_ExtendField"]).Trim(); // 扩展字段 // return nc; //} //#endregion #region "sys_User(用户表) - DataProvider" /// <summary> /// 新增/删除/修改 sys_UserTable (用户表) /// </summary> /// <param name="fam">sys_User实体类</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public abstract int sys_UserInsertUpdate(sys_UserTable fam);
/// <summary> /// 新增/删除/修改 sys_User /// </summary> /// <param name="fam">sys_UserTable实体类</param> /// <returns>返回0操正常</returns> public override int sys_UserInsertUpdate(sys_UserTable fam) { int rInt = 0; using (OracleConnection Conn = GetSqlConnection()) { string CommTxt; OracleCommand cmd = new OracleCommand(); cmd.Connection = Conn; if (fam.DB_Option_Action_ == "Insert") { CommTxt = "Insert into sys_User(UserID,U_LoginName,U_Password,U_CName,U_EName,U_GroupID,U_Email,U_Type,U_Status,U_Licence,U_Mac,U_Remark,U_IDCard,U_Sex,U_BirthDay,U_MobileNo,U_UserNO,U_WorkStartDate,U_WorkEndDate,U_CompanyMail,U_Title,U_Extension,U_HomeTel,U_PhotoUrl,U_DateTime,U_LastIP,U_LastDateTime,U_ExtendField)VALUES(SEQ_sys_User_ID.NEXTVAL,:U_LoginName,:U_Password,:U_CName,:U_EName,:U_GroupID,:U_Email,:U_Type,:U_Status,:U_Licence,:U_Mac,:U_Remark,:U_IDCard,:U_Sex,:U_BirthDay,:U_MobileNo,:U_UserNO,:U_WorkStartDate,:U_WorkEndDate,:U_CompanyMail,:U_Title,:U_Extension,:U_HomeTel,:U_PhotoUrl,:U_DateTime,:U_LastIP,:U_LastDateTime,:U_ExtendField)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("U_LoginName", OracleType.NVarChar).Value = fam.U_LoginName + ""; //登陆名 cmd.Parameters.Add("U_Password", OracleType.VarChar).Value = fam.U_Password + ""; //密码md5加密字符 cmd.Parameters.Add("U_CName", OracleType.NVarChar).Value = fam.U_CName + ""; //中文姓名 cmd.Parameters.Add("U_EName", OracleType.VarChar).Value = fam.U_EName + ""; //英文名 cmd.Parameters.Add("U_GroupID", OracleType.Int32).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 cmd.Parameters.Add("U_Email", OracleType.VarChar).Value = fam.U_Email + ""; //电子邮件 cmd.Parameters.Add("U_Type", OracleType.SByte).Value = fam.U_Type; //用户类型0:超级用户1:普通用户 cmd.Parameters.Add("U_Status", OracleType.SByte).Value = fam.U_Status; //当前状态0:正常 1:禁止登陆 2:删除 cmd.Parameters.Add("U_Licence", OracleType.VarChar).Value = fam.U_Licence + ""; //用户序列号 cmd.Parameters.Add("U_Mac", OracleType.VarChar).Value = fam.U_Mac + ""; //锁定机器硬件地址 cmd.Parameters.Add("U_Remark", OracleType.NVarChar).Value = fam.U_Remark + ""; //备注说明 cmd.Parameters.Add("U_IDCard", OracleType.VarChar).Value = fam.U_IDCard + ""; //身份证号码 cmd.Parameters.Add("U_Sex", OracleType.SByte).Value = fam.U_Sex; //性别1:男0:女 if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = fam.U_BirthDay; //出生日期 else cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = DBNull.Value; //出生日期 cmd.Parameters.Add("U_MobileNo", OracleType.VarChar).Value = fam.U_MobileNo + ""; //手机号 cmd.Parameters.Add("U_UserNO", OracleType.VarChar).Value = fam.U_UserNO + ""; //员工编号 if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = fam.U_WorkStartDate; //到职日期 else cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = DBNull.Value; //到职日期 if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = fam.U_WorkEndDate; //离职日期 else cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = DBNull.Value; //离职日期 cmd.Parameters.Add("U_CompanyMail", OracleType.VarChar).Value = fam.U_CompanyMail + ""; //公司邮件地址 cmd.Parameters.Add("U_Title", OracleType.Int32).Value = fam.U_Title; //职称与应用字段关联 cmd.Parameters.Add("U_Extension", OracleType.VarChar).Value = fam.U_Extension + ""; //分机号 cmd.Parameters.Add("U_HomeTel", OracleType.VarChar).Value = fam.U_HomeTel + ""; //家中电话 cmd.Parameters.Add("U_PhotoUrl", OracleType.NVarChar).Value = fam.U_PhotoUrl + ""; //用户照片网址 cmd.Parameters.Add("U_DateTime", OracleType.DateTime).Value = fam.U_DateTime; //操作时间 cmd.Parameters.Add("U_LastIP", OracleType.VarChar).Value = fam.U_LastIP + ""; //最后访问IP cmd.Parameters.Add("U_LastDateTime", OracleType.DateTime).Value = fam.U_LastDateTime; //最后访问时间 cmd.Parameters.Add("U_ExtendField", OracleType.VarChar).Value = fam.U_ExtendField + ""; //扩展字段 } else if (fam.DB_Option_Action_ == "Update") { CommTxt = "UPDATE sys_User SET U_LoginName = :U_LoginName,U_Password = :U_Password,U_CName = :U_CName,U_EName = :U_EName,U_GroupID = :U_GroupID,U_Email = :U_Email,U_Type = :U_Type,U_Status = :U_Status,U_Licence = :U_Licence,U_Mac = :U_Mac,U_Remark = :U_Remark,U_IDCard = :U_IDCard,U_Sex = :U_Sex,U_BirthDay = :U_BirthDay,U_MobileNo = :U_MobileNo,U_UserNO = :U_UserNO,U_WorkStartDate = :U_WorkStartDate,U_WorkEndDate = :U_WorkEndDate,U_CompanyMail = :U_CompanyMail,U_Title = :U_Title,U_Extension = :U_Extension,U_HomeTel = :U_HomeTel,U_PhotoUrl = :U_PhotoUrl,U_DateTime = :U_DateTime,U_LastIP = :U_LastIP,U_LastDateTime = :U_LastDateTime,U_ExtendField = :U_ExtendField WHERE (UserID = :UserID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("U_LoginName", OracleType.NVarChar).Value = fam.U_LoginName + ""; //登陆名 cmd.Parameters.Add("U_Password", OracleType.VarChar).Value = fam.U_Password + ""; //密码md5加密字符 cmd.Parameters.Add("U_CName", OracleType.NVarChar).Value = fam.U_CName + ""; //中文姓名 cmd.Parameters.Add("U_EName", OracleType.VarChar).Value = fam.U_EName + ""; //英文名 cmd.Parameters.Add("U_GroupID", OracleType.Int32).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 cmd.Parameters.Add("U_Email", OracleType.VarChar).Value = fam.U_Email + ""; //电子邮件 cmd.Parameters.Add("U_Type", OracleType.SByte).Value = fam.U_Type; //用户类型0:超级用户1:普通用户 cmd.Parameters.Add("U_Status", OracleType.SByte).Value = fam.U_Status; //当前状态0:正常 1:禁止登陆 2:删除 cmd.Parameters.Add("U_Licence", OracleType.VarChar).Value = fam.U_Licence + ""; //用户序列号 cmd.Parameters.Add("U_Mac", OracleType.VarChar).Value = fam.U_Mac + ""; //锁定机器硬件地址 cmd.Parameters.Add("U_Remark", OracleType.NVarChar).Value = fam.U_Remark + ""; //备注说明 cmd.Parameters.Add("U_IDCard", OracleType.VarChar).Value = fam.U_IDCard + ""; //身份证号码 cmd.Parameters.Add("U_Sex", OracleType.SByte).Value = fam.U_Sex; //性别1:男0:女 if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = fam.U_BirthDay; //出生日期 else cmd.Parameters.Add("U_BirthDay", OracleType.DateTime).Value = DBNull.Value; //出生日期 cmd.Parameters.Add("U_MobileNo", OracleType.VarChar).Value = fam.U_MobileNo + ""; //手机号 cmd.Parameters.Add("U_UserNO", OracleType.VarChar).Value = fam.U_UserNO + ""; //员工编号 if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = fam.U_WorkStartDate; //到职日期 else cmd.Parameters.Add("U_WorkStartDate", OracleType.DateTime).Value = DBNull.Value; //到职日期 if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = fam.U_WorkEndDate; //离职日期 else cmd.Parameters.Add("U_WorkEndDate", OracleType.DateTime).Value = DBNull.Value; //离职日期 cmd.Parameters.Add("U_CompanyMail", OracleType.VarChar).Value = fam.U_CompanyMail + ""; //公司邮件地址 cmd.Parameters.Add("U_Title", OracleType.Int32).Value = fam.U_Title; //职称与应用字段关联 cmd.Parameters.Add("U_Extension", OracleType.VarChar).Value = fam.U_Extension + ""; //分机号 cmd.Parameters.Add("U_HomeTel", OracleType.VarChar).Value = fam.U_HomeTel + ""; //家中电话 cmd.Parameters.Add("U_PhotoUrl", OracleType.NVarChar).Value = fam.U_PhotoUrl + ""; //用户照片网址 cmd.Parameters.Add("U_DateTime", OracleType.DateTime).Value = fam.U_DateTime; //操作时间 cmd.Parameters.Add("U_LastIP", OracleType.VarChar).Value = fam.U_LastIP + ""; //最后访问IP cmd.Parameters.Add("U_LastDateTime", OracleType.DateTime).Value = fam.U_LastDateTime; //最后访问时间 cmd.Parameters.Add("U_ExtendField", OracleType.VarChar).Value = fam.U_ExtendField + ""; //扩展字段 cmd.Parameters.Add("UserID", OracleType.Int32).Value = fam.UserID; } else if (fam.DB_Option_Action_ == "Delete") { CommTxt = "Delete from sys_User WHERE (UserID = :UserID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("UserID", OracleType.Int32).Value = fam.UserID; } else throw new ApplicationException("无法识别的操作命令!"); Conn.Open(); OracleTransaction Tran = Conn.BeginTransaction(); cmd.Transaction = Tran; try { rInt = cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); if (fam.DB_Option_Action_ == "Insert") { cmd.CommandText = "select SEQ_sys_User_ID.CURRVAL from dual"; rInt = Convert.ToInt32(cmd.ExecuteScalar()); } Tran.Commit(); } catch (Exception ex) { Tran.Rollback(); throw new ApplicationException(ex.ToString()); } finally { Tran.Dispose(); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } } return rInt; }
//#region "sys_User - AccessDataProvider" ///// <summary> ///// 新增/删除/修改 sys_User ///// </summary> ///// <param name="fam">sys_UserTable实体类</param> ///// <returns>返回0操正常</returns> //public override int sys_UserInsertUpdate(sys_UserTable fam) //{ // int rInt = 0; // using (OleDbConnection Conn = GetSqlConnection()) // { // string CommTxt; // OleDbCommand cmd = new OleDbCommand(); // cmd.Connection = Conn; // if (fam.DB_Option_Action_ == "Insert") // { // CommTxt = "Insert into sys_User(U_LoginName,U_Password,U_CName,U_EName,U_GroupID,U_Email,U_Type,U_Status,U_Licence,U_Mac,U_Remark,U_IDCard,U_Sex,U_BirthDay,U_MobileNo,U_UserNO,U_WorkStartDate,U_WorkEndDate,U_CompanyMail,U_Title,U_Extension,U_HomeTel,U_PhotoUrl,U_DateTime,U_LastIP,U_LastDateTime,U_ExtendField)VALUES(@U_LoginName,@U_Password,@U_CName,@U_EName,@U_GroupID,@U_Email,@U_Type,@U_Status,@U_Licence,@U_Mac,@U_Remark,@U_IDCard,@U_Sex,@U_BirthDay,@U_MobileNo,@U_UserNO,@U_WorkStartDate,@U_WorkEndDate,@U_CompanyMail,@U_Title,@U_Extension,@U_HomeTel,@U_PhotoUrl,@U_DateTime,@U_LastIP,@U_LastDateTime,@U_ExtendField,@SignPicture,@SignPassword)"; // cmd.CommandText = CommTxt; // cmd.Parameters.Add("@U_LoginName", OleDbType.VarWChar).Value = fam.U_LoginName + ""; //登陆名 // cmd.Parameters.Add("@U_Password", OleDbType.VarWChar).Value = fam.U_Password + ""; //密码md5加密字符 // cmd.Parameters.Add("@U_CName", OleDbType.VarWChar).Value = fam.U_CName + ""; //中文姓名 // cmd.Parameters.Add("@U_EName", OleDbType.VarWChar).Value = fam.U_EName + ""; //英文名 // cmd.Parameters.Add("@U_GroupID", OleDbType.Integer).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 // cmd.Parameters.Add("@U_Email", OleDbType.VarWChar).Value = fam.U_Email + ""; //电子邮件 // cmd.Parameters.Add("@U_Type", OleDbType.LongVarWChar).Value = fam.U_Type + ""; //用户类型0:超级用户1:普通用户 // cmd.Parameters.Add("@U_Status", OleDbType.LongVarWChar).Value = fam.U_Status + ""; //当前状态0:正常 1:禁止 // cmd.Parameters.Add("@U_Licence", OleDbType.VarWChar).Value = fam.U_Licence + ""; //用户序列号 // cmd.Parameters.Add("@U_Mac", OleDbType.VarWChar).Value = fam.U_Mac + ""; //锁定机器硬件地址 // cmd.Parameters.Add("@U_Remark", OleDbType.VarWChar).Value = fam.U_Remark + ""; //备注说明 // cmd.Parameters.Add("@U_IDCard", OleDbType.VarWChar).Value = fam.U_IDCard + ""; //身份证号码 // cmd.Parameters.Add("@U_Sex", OleDbType.LongVarWChar).Value = fam.U_Sex + ""; //性别1:男0:女 // if (fam.U_BirthDay.HasValue) // cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = fam.U_BirthDay; //出生日期 // else // cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = DBNull.Value; //出生日期 // cmd.Parameters.Add("@U_MobileNo", OleDbType.VarWChar).Value = fam.U_MobileNo + ""; //手机号 // cmd.Parameters.Add("@U_UserNO", OleDbType.VarWChar).Value = fam.U_UserNO + ""; //员工编号 // if (fam.U_WorkStartDate.HasValue) // cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = fam.U_WorkStartDate; //到职日期 // else // cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = DBNull.Value; //到职日期 // if (fam.U_WorkEndDate.HasValue) // cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = fam.U_WorkEndDate; //离职日期 // else // cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = DBNull.Value; //离职日期 // cmd.Parameters.Add("@U_CompanyMail", OleDbType.VarWChar).Value = fam.U_CompanyMail + ""; //公司邮件地址 // cmd.Parameters.Add("@U_Title", OleDbType.Integer).Value = fam.U_Title; //职称与应用字段关联 // cmd.Parameters.Add("@U_Extension", OleDbType.VarWChar).Value = fam.U_Extension + ""; //分机号 // cmd.Parameters.Add("@U_HomeTel", OleDbType.VarWChar).Value = fam.U_HomeTel + ""; //家中电话 // cmd.Parameters.Add("@U_PhotoUrl", OleDbType.VarWChar).Value = fam.U_PhotoUrl + ""; //用户照片网址 // cmd.Parameters.Add("@U_DateTime", OleDbType.Date).Value = fam.U_DateTime; //操作时间 // cmd.Parameters.Add("@U_LastIP", OleDbType.VarWChar).Value = fam.U_LastIP + ""; //最后访问IP // cmd.Parameters.Add("@U_LastDateTime", OleDbType.Date).Value = fam.U_LastDateTime; //最后访问时间 // cmd.Parameters.Add("@U_ExtendField", OleDbType.LongVarWChar).Value = fam.U_ExtendField + ""; //扩展字段 // cmd.Parameters.Add("@SignPicture", OleDbType.VarChar).Value = fam.SignPicture; //SignPicture // cmd.Parameters.Add("@SignPassword", OleDbType.VarChar).Value = fam.SignPassword; //SignPassword // } // else if (fam.DB_Option_Action_ == "Update") // { // CommTxt = "UPDATE sys_User SET U_LoginName = @U_LoginName,U_Password = @U_Password,U_CName = @U_CName,U_EName = @U_EName,U_GroupID = @U_GroupID,U_Email = @U_Email,U_Type = @U_Type,U_Status = @U_Status,U_Licence = @U_Licence,U_Mac = @U_Mac,U_Remark = @U_Remark,U_IDCard = @U_IDCard,U_Sex = @U_Sex,U_BirthDay = @U_BirthDay,U_MobileNo = @U_MobileNo,U_UserNO = @U_UserNO,U_WorkStartDate = @U_WorkStartDate,U_WorkEndDate = @U_WorkEndDate,U_CompanyMail = @U_CompanyMail,U_Title = @U_Title,U_Extension = @U_Extension,U_HomeTel = @U_HomeTel,U_PhotoUrl = @U_PhotoUrl,U_DateTime = @U_DateTime,U_LastIP = @U_LastIP,U_LastDateTime = @U_LastDateTime,U_ExtendField = @U_ExtendField,SignPicture = @SignPicture,SignPassword = @SignPassword WHERE (UserID = @UserID)"; // cmd.CommandText = CommTxt; // cmd.Parameters.Add("@U_LoginName", OleDbType.VarWChar).Value = fam.U_LoginName + ""; //登陆名 // cmd.Parameters.Add("@U_Password", OleDbType.VarWChar).Value = fam.U_Password + ""; //密码md5加密字符 // cmd.Parameters.Add("@U_CName", OleDbType.VarWChar).Value = fam.U_CName + ""; //中文姓名 // cmd.Parameters.Add("@U_EName", OleDbType.VarWChar).Value = fam.U_EName + ""; //英文名 // cmd.Parameters.Add("@U_GroupID", OleDbType.Integer).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 // cmd.Parameters.Add("@U_Email", OleDbType.VarWChar).Value = fam.U_Email + ""; //电子邮件 // cmd.Parameters.Add("@U_Type", OleDbType.LongVarWChar).Value = fam.U_Type + ""; //用户类型0:超级用户1:普通用户 // cmd.Parameters.Add("@U_Status", OleDbType.LongVarWChar).Value = fam.U_Status + ""; //当前状态0:正常 1:禁止 // cmd.Parameters.Add("@U_Licence", OleDbType.VarWChar).Value = fam.U_Licence + ""; //用户序列号 // cmd.Parameters.Add("@U_Mac", OleDbType.VarWChar).Value = fam.U_Mac + ""; //锁定机器硬件地址 // cmd.Parameters.Add("@U_Remark", OleDbType.VarWChar).Value = fam.U_Remark + ""; //备注说明 // cmd.Parameters.Add("@U_IDCard", OleDbType.VarWChar).Value = fam.U_IDCard + ""; //身份证号码 // cmd.Parameters.Add("@U_Sex", OleDbType.LongVarWChar).Value = fam.U_Sex + ""; //性别1:男0:女 // if (fam.U_BirthDay.HasValue) // cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = fam.U_BirthDay; //出生日期 // else // cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = DBNull.Value; //出生日期 // cmd.Parameters.Add("@U_MobileNo", OleDbType.VarWChar).Value = fam.U_MobileNo + ""; //手机号 // cmd.Parameters.Add("@U_UserNO", OleDbType.VarWChar).Value = fam.U_UserNO + ""; //员工编号 // if (fam.U_WorkStartDate.HasValue) // cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = fam.U_WorkStartDate; //到职日期 // else // cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = DBNull.Value; //到职日期 // if (fam.U_WorkEndDate.HasValue) // cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = fam.U_WorkEndDate; //离职日期 // else // cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = DBNull.Value; //离职日期 // cmd.Parameters.Add("@U_CompanyMail", OleDbType.VarWChar).Value = fam.U_CompanyMail + ""; //公司邮件地址 // cmd.Parameters.Add("@U_Title", OleDbType.Integer).Value = fam.U_Title; //职称与应用字段关联 // cmd.Parameters.Add("@U_Extension", OleDbType.VarWChar).Value = fam.U_Extension + ""; //分机号 // cmd.Parameters.Add("@U_HomeTel", OleDbType.VarWChar).Value = fam.U_HomeTel + ""; //家中电话 // cmd.Parameters.Add("@U_PhotoUrl", OleDbType.VarWChar).Value = fam.U_PhotoUrl + ""; //用户照片网址 // cmd.Parameters.Add("@U_DateTime", OleDbType.Date).Value = fam.U_DateTime; //操作时间 // cmd.Parameters.Add("@U_LastIP", OleDbType.VarWChar).Value = fam.U_LastIP + ""; //最后访问IP // cmd.Parameters.Add("@U_LastDateTime", OleDbType.Date).Value = fam.U_LastDateTime; //最后访问时间 // cmd.Parameters.Add("@U_ExtendField", OleDbType.LongVarWChar).Value = fam.U_ExtendField + ""; //扩展字段 // cmd.Parameters.Add("@UserID", OleDbType.Integer).Value = fam.UserID; // cmd.Parameters.Add("@SignPicture", OleDbType.VarChar).Value = fam.SignPicture; //SignPicture // cmd.Parameters.Add("@SignPassword", OleDbType.VarChar).Value = fam.SignPassword; //SignPassword // } // else if (fam.DB_Option_Action_ == "Delete") // { // CommTxt = "Delete from sys_User WHERE (UserID = @UserID)"; // cmd.CommandText = CommTxt; // cmd.Parameters.Add("@UserID", OleDbType.Integer).Value = fam.UserID; // } // else // throw new ApplicationException("无法识别的操作命令!"); // Conn.Open(); // rInt = cmd.ExecuteNonQuery(); // if (fam.DB_Option_Action_ == "Insert") // { // cmd.CommandText = "SELECT @@identity"; // rInt = Convert.ToInt32(cmd.ExecuteScalar()); // } // cmd.Dispose(); // Conn.Dispose(); // Conn.Close(); // } // return rInt; //} ///// <summary> ///// 返回sys_UserTable实体类的ArrayList对象 ///// </summary> ///// <param name="qp">查询类</param> ///// <param name="RecordCount">返回记录总数</param> ///// <returns>sys_UserTable实体类的ArrayList对象</returns> //public override ArrayList sys_UserList(QueryParam qp, out int RecordCount) //{ // PopulateDelegate mypd = new PopulateDelegate(base.Populatesys_User); // return this.GetObjectList(mypd, qp, out RecordCount); //} //#endregion #region "sys_User (用户表) - AccessDataProvider" /// <summary> /// 新增/删除/修改 sys_User (用户表) /// </summary> /// <param name="fam">sys_UserTable实体类实体类(用户表)</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public override int sys_UserInsertUpdate(sys_UserTable fam) { Int32 rInt = -1; using (OleDbConnection Conn = GetSqlConnection()) { string CommTxt; OleDbCommand cmd = new OleDbCommand(); cmd.Connection = Conn; Conn.Open(); if (fam.DB_Option_Action_.ToString() == "Insert") { CommTxt = "Insert into sys_User(U_LoginName,U_Password,U_CName,U_EName,U_GroupID,U_Email,U_Type,U_Status,U_Licence,U_Mac,U_Remark,U_IDCard,U_Sex,U_BirthDay,U_MobileNo,U_UserNO,U_WorkStartDate,U_WorkEndDate,U_CompanyMail,U_Title,U_Extension,U_HomeTel,U_PhotoUrl,U_DateTime,U_LastIP,U_LastDateTime,U_ExtendField,SignPicture,SignPassword)VALUES(@U_LoginName,@U_Password,@U_CName,@U_EName,@U_GroupID,@U_Email,@U_Type,@U_Status,@U_Licence,@U_Mac,@U_Remark,@U_IDCard,@U_Sex,@U_BirthDay,@U_MobileNo,@U_UserNO,@U_WorkStartDate,@U_WorkEndDate,@U_CompanyMail,@U_Title,@U_Extension,@U_HomeTel,@U_PhotoUrl,@U_DateTime,@U_LastIP,@U_LastDateTime,@U_ExtendField,@SignPicture,@SignPassword)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("@U_LoginName", OleDbType.VarWChar).Value = fam.U_LoginName; //登陆名 cmd.Parameters.Add("@U_Password", OleDbType.VarChar).Value = fam.U_Password; //密码md5加密字符 cmd.Parameters.Add("@U_CName", OleDbType.VarWChar).Value = fam.U_CName; //中文姓名 cmd.Parameters.Add("@U_EName", OleDbType.VarChar).Value = fam.U_EName; //英文名 cmd.Parameters.Add("@U_GroupID", OleDbType.Integer).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 cmd.Parameters.Add("@U_Email", OleDbType.VarChar).Value = fam.U_Email; //电子邮件 cmd.Parameters.Add("@U_Type", OleDbType.TinyInt).Value = fam.U_Type; //用户类型0:超级用户1:普通用户 cmd.Parameters.Add("@U_Status", OleDbType.TinyInt).Value = fam.U_Status; //当前状态0:正常 1:禁止登陆 2:删除 cmd.Parameters.Add("@U_Licence", OleDbType.VarChar).Value = fam.U_Licence; //用户序列号 cmd.Parameters.Add("@U_Mac", OleDbType.VarChar).Value = fam.U_Mac; //锁定机器硬件地址 cmd.Parameters.Add("@U_Remark", OleDbType.VarWChar).Value = fam.U_Remark; //备注说明 cmd.Parameters.Add("@U_IDCard", OleDbType.VarChar).Value = fam.U_IDCard; //身份证号码 cmd.Parameters.Add("@U_Sex", OleDbType.TinyInt).Value = fam.U_Sex; //性别1:男0:女 if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = fam.U_BirthDay; //出生日期 else cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = DBNull.Value; //出生日期 cmd.Parameters.Add("@U_MobileNo", OleDbType.VarChar).Value = fam.U_MobileNo; //手机号 cmd.Parameters.Add("@U_UserNO", OleDbType.VarChar).Value = fam.U_UserNO; //员工编号 if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = fam.U_WorkStartDate; //到职日期 else cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = DBNull.Value; //到职日期 if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = fam.U_WorkEndDate; //离职日期 else cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = DBNull.Value; //离职日期 cmd.Parameters.Add("@U_CompanyMail", OleDbType.VarChar).Value = fam.U_CompanyMail; //公司邮件地址 cmd.Parameters.Add("@U_Title", OleDbType.Integer).Value = fam.U_Title; //职称与应用字段关联 cmd.Parameters.Add("@U_Extension", OleDbType.VarChar).Value = fam.U_Extension; //分机号 cmd.Parameters.Add("@U_HomeTel", OleDbType.VarChar).Value = fam.U_HomeTel; //家中电话 cmd.Parameters.Add("@U_PhotoUrl", OleDbType.VarWChar).Value = fam.U_PhotoUrl; //用户照片网址 cmd.Parameters.Add("@U_DateTime", OleDbType.Date).Value = fam.U_DateTime; //操作时间 cmd.Parameters.Add("@U_LastIP", OleDbType.VarChar).Value = fam.U_LastIP; //最后访问IP cmd.Parameters.Add("@U_LastDateTime", OleDbType.Date).Value = fam.U_LastDateTime; //最后访问时间 cmd.Parameters.Add("@U_ExtendField", OleDbType.LongVarWChar).Value = fam.U_ExtendField; //扩展字段 cmd.Parameters.Add("@SignPicture", OleDbType.VarChar).Value = fam.SignPicture; //SignPicture cmd.Parameters.Add("@SignPassword", OleDbType.VarChar).Value = fam.SignPassword; //SignPassword } else if (fam.DB_Option_Action_.ToString() == "Update") { CommTxt = "UPDATE sys_User SET U_LoginName = @U_LoginName,U_Password = @U_Password,U_CName = @U_CName,U_EName = @U_EName,U_GroupID = @U_GroupID,U_Email = @U_Email,U_Type = @U_Type,U_Status = @U_Status,U_Licence = @U_Licence,U_Mac = @U_Mac,U_Remark = @U_Remark,U_IDCard = @U_IDCard,U_Sex = @U_Sex,U_BirthDay = @U_BirthDay,U_MobileNo = @U_MobileNo,U_UserNO = @U_UserNO,U_WorkStartDate = @U_WorkStartDate,U_WorkEndDate = @U_WorkEndDate,U_CompanyMail = @U_CompanyMail,U_Title = @U_Title,U_Extension = @U_Extension,U_HomeTel = @U_HomeTel,U_PhotoUrl = @U_PhotoUrl,U_DateTime = @U_DateTime,U_LastIP = @U_LastIP,U_LastDateTime = @U_LastDateTime,U_ExtendField = @U_ExtendField,SignPicture = @SignPicture,SignPassword = @SignPassword WHERE (UserID = @UserID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("@U_LoginName", OleDbType.VarWChar).Value = fam.U_LoginName; //登陆名 cmd.Parameters.Add("@U_Password", OleDbType.VarChar).Value = fam.U_Password; //密码md5加密字符 cmd.Parameters.Add("@U_CName", OleDbType.VarWChar).Value = fam.U_CName; //中文姓名 cmd.Parameters.Add("@U_EName", OleDbType.VarChar).Value = fam.U_EName; //英文名 cmd.Parameters.Add("@U_GroupID", OleDbType.Integer).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 cmd.Parameters.Add("@U_Email", OleDbType.VarChar).Value = fam.U_Email; //电子邮件 cmd.Parameters.Add("@U_Type", OleDbType.TinyInt).Value = fam.U_Type; //用户类型0:超级用户1:普通用户 cmd.Parameters.Add("@U_Status", OleDbType.TinyInt).Value = fam.U_Status; //当前状态0:正常 1:禁止登陆 2:删除 cmd.Parameters.Add("@U_Licence", OleDbType.VarChar).Value = fam.U_Licence; //用户序列号 cmd.Parameters.Add("@U_Mac", OleDbType.VarChar).Value = fam.U_Mac; //锁定机器硬件地址 cmd.Parameters.Add("@U_Remark", OleDbType.VarWChar).Value = fam.U_Remark; //备注说明 cmd.Parameters.Add("@U_IDCard", OleDbType.VarChar).Value = fam.U_IDCard; //身份证号码 cmd.Parameters.Add("@U_Sex", OleDbType.TinyInt).Value = fam.U_Sex; //性别1:男0:女 if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = fam.U_BirthDay; //出生日期 else cmd.Parameters.Add("@U_BirthDay", OleDbType.Date).Value = DBNull.Value; //出生日期 cmd.Parameters.Add("@U_MobileNo", OleDbType.VarChar).Value = fam.U_MobileNo; //手机号 cmd.Parameters.Add("@U_UserNO", OleDbType.VarChar).Value = fam.U_UserNO; //员工编号 if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = fam.U_WorkStartDate; //到职日期 else cmd.Parameters.Add("@U_WorkStartDate", OleDbType.Date).Value = DBNull.Value; //到职日期 if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = fam.U_WorkEndDate; //离职日期 else cmd.Parameters.Add("@U_WorkEndDate", OleDbType.Date).Value = DBNull.Value; //离职日期 cmd.Parameters.Add("@U_CompanyMail", OleDbType.VarChar).Value = fam.U_CompanyMail; //公司邮件地址 cmd.Parameters.Add("@U_Title", OleDbType.Integer).Value = fam.U_Title; //职称与应用字段关联 cmd.Parameters.Add("@U_Extension", OleDbType.VarChar).Value = fam.U_Extension; //分机号 cmd.Parameters.Add("@U_HomeTel", OleDbType.VarChar).Value = fam.U_HomeTel; //家中电话 cmd.Parameters.Add("@U_PhotoUrl", OleDbType.VarWChar).Value = fam.U_PhotoUrl; //用户照片网址 cmd.Parameters.Add("@U_DateTime", OleDbType.Date).Value = fam.U_DateTime; //操作时间 cmd.Parameters.Add("@U_LastIP", OleDbType.VarChar).Value = fam.U_LastIP; //最后访问IP cmd.Parameters.Add("@U_LastDateTime", OleDbType.Date).Value = fam.U_LastDateTime; //最后访问时间 cmd.Parameters.Add("@U_ExtendField", OleDbType.LongVarWChar).Value = fam.U_ExtendField; //扩展字段 cmd.Parameters.Add("@SignPicture", OleDbType.VarChar).Value = fam.SignPicture; //SignPicture cmd.Parameters.Add("@SignPassword", OleDbType.VarChar).Value = fam.SignPassword; //SignPassword cmd.Parameters.Add("@用户ID号", OleDbType.Integer).Value = fam.UserID; //用户ID号 } else if (fam.DB_Option_Action_.ToString() == "Delete") { CommTxt = "Delete from sys_User WHERE (UserID = @UserID)"; cmd.CommandText = CommTxt; cmd.Parameters.Add("@UserID", OleDbType.Integer).Value = fam.UserID; //用户ID号 } else throw new ApplicationException("无法识别的操作命令!"); rInt = cmd.ExecuteNonQuery(); if (fam.DB_Option_Action_.ToString() == "Insert") { cmd.CommandText = "SELECT @@identity"; rInt = Convert.ToInt32(cmd.ExecuteScalar()); } cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
/// <summary> /// 检测是否违反sys_User表的PK值 /// </summary> /// <param name="fam">sys_UserTable类</param> /// <param name="pt">PopedomType类型,只对New,Edit有效</param> /// <returns></returns> public static bool sys_UserTableCheckPK(sys_UserTable fam, PopedomType pt) { QueryParam qp = new QueryParam(); if (pt == PopedomType.New) qp.Where = string.Format(" Where U_LoginName='{0}'", fam.U_LoginName); else if (pt == PopedomType.Edit) qp.Where = string.Format(" Where U_LoginName='{0}' and UserID<>{1} ", fam.U_LoginName, fam.UserID); int RecordCount = 0; sys_UserList(qp, out RecordCount); if (RecordCount > 0) { return true; } else { return false; } }
/// <summary> /// 新增/删除/修改 sys_User /// </summary> /// <param name="fam">sys_UserTable实体类</param> /// <returns>返回0操正常</returns> public static int sys_UserInsertUpdate(sys_UserTable fam) { return DataProvider.Instance().sys_UserInsertUpdate(fam); }
/// <summary> /// 根据ID返回 sys_UserTable实体类 单笔资料 /// </summary> /// <param name="UserID">用户ID号</param> /// <returns>返回sys_UserTable实体类 UserID为0则无记录</returns> public static sys_UserTable sys_UserDisp(int UserID) { sys_UserTable fam = new sys_UserTable(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = " Where sys_User.UserID = " + UserID; int RecordCount = 0; ArrayList lst = sys_UserList(qp, out RecordCount); if (RecordCount > 0) { fam = (sys_UserTable)lst[0]; } return fam; }
//#region "sys_User - SQLDataProvider" ///// <summary> ///// 新增/删除/修改 sys_User ///// </summary> ///// <param name="fam">sys_UserTable实体类</param> ///// <returns>返回0操正常</returns> //public override int sys_UserInsertUpdate(sys_UserTable fam) //{ // int rInt = 0; // using (SqlConnection Conn = GetSqlConnection()) // { // SqlCommand cmd = new SqlCommand("sys_UserInsertUpdateDelete", Conn); // cmd.CommandType = CommandType.StoredProcedure; // //设置参数 // cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录 // cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = fam.UserID; //用户ID号 // cmd.Parameters.Add("@U_LoginName", SqlDbType.NVarChar).Value = fam.U_LoginName; //登陆名 // cmd.Parameters.Add("@U_Password", SqlDbType.VarChar).Value = fam.U_Password; //密码md5加密字符 // cmd.Parameters.Add("@U_CName", SqlDbType.NVarChar).Value = fam.U_CName; //中文姓名 // cmd.Parameters.Add("@U_EName", SqlDbType.VarChar).Value = fam.U_EName; //英文名 // cmd.Parameters.Add("@U_GroupID", SqlDbType.Int).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 // cmd.Parameters.Add("@U_Email", SqlDbType.VarChar).Value = fam.U_Email; //电子邮件 // cmd.Parameters.Add("@U_Type", SqlDbType.Int).Value = fam.U_Type; //用户类型0:超级用户1:普通用户 // cmd.Parameters.Add("@U_Status", SqlDbType.Int).Value = fam.U_Status; //当前状态0:正常 1:禁止 // cmd.Parameters.Add("@U_Licence", SqlDbType.VarChar).Value = fam.U_Licence; //用户序列号 // cmd.Parameters.Add("@U_Mac", SqlDbType.VarChar).Value = fam.U_Mac; //锁定机器硬件地址 // cmd.Parameters.Add("@U_Remark", SqlDbType.NVarChar).Value = fam.U_Remark; //备注说明 // cmd.Parameters.Add("@U_IDCard", SqlDbType.VarChar).Value = fam.U_IDCard; //身份证号码 // cmd.Parameters.Add("@U_Sex", SqlDbType.Int).Value = fam.U_Sex; //性别1:男0:女 // if (fam.U_BirthDay.HasValue) // cmd.Parameters.Add("@U_BirthDay", SqlDbType.DateTime).Value = fam.U_BirthDay; //出生日期 // else // cmd.Parameters.Add("@U_BirthDay", SqlDbType.DateTime).Value = DBNull.Value; //出生日期 // cmd.Parameters.Add("@U_MobileNo", SqlDbType.VarChar).Value = fam.U_MobileNo; //手机号 // cmd.Parameters.Add("@U_UserNO", SqlDbType.VarChar).Value = fam.U_UserNO; //员工编号 // if (fam.U_WorkStartDate.HasValue) // cmd.Parameters.Add("@U_WorkStartDate", SqlDbType.DateTime).Value = fam.U_WorkStartDate; //到职日期 // else // cmd.Parameters.Add("@U_WorkStartDate", SqlDbType.DateTime).Value = DBNull.Value; //到职日期 // if (fam.U_WorkEndDate.HasValue) // cmd.Parameters.Add("@U_WorkEndDate", SqlDbType.DateTime).Value = fam.U_WorkEndDate; //离职日期 // else // cmd.Parameters.Add("@U_WorkEndDate", SqlDbType.DateTime).Value = DBNull.Value; //离职日期 // cmd.Parameters.Add("@U_CompanyMail", SqlDbType.VarChar).Value = fam.U_CompanyMail; //公司邮件地址 // cmd.Parameters.Add("@U_Title", SqlDbType.Int).Value = fam.U_Title; //职称与应用字段关联 // cmd.Parameters.Add("@U_Extension", SqlDbType.VarChar).Value = fam.U_Extension; //分机号 // cmd.Parameters.Add("@U_HomeTel", SqlDbType.VarChar).Value = fam.U_HomeTel; //家中电话 // cmd.Parameters.Add("@U_PhotoUrl", SqlDbType.NVarChar).Value = fam.U_PhotoUrl; //用户照片网址 // cmd.Parameters.Add("@U_DateTime", SqlDbType.DateTime).Value = fam.U_DateTime; //操作时间 // cmd.Parameters.Add("@U_LastIP", SqlDbType.VarChar).Value = fam.U_LastIP; //最后访问IP // cmd.Parameters.Add("@U_LastDateTime", SqlDbType.DateTime).Value = fam.U_LastDateTime; //最后访问时间 // cmd.Parameters.Add("@U_ExtendField", SqlDbType.NText).Value = fam.U_ExtendField; //扩展字段 // cmd.Parameters.Add("@SignPicture", SqlDbType.VarChar).Value = fam.SignPicture; //SignPicture // cmd.Parameters.Add("@SignPassword", SqlDbType.VarChar).Value = fam.SignPassword; //SignPassword // Conn.Open(); // rInt = Convert.ToInt32(cmd.ExecuteScalar()); // cmd.Dispose(); // Conn.Dispose(); // Conn.Close(); // } // return rInt; //} ///// <summary> ///// 返回sys_UserTable实体类的ArrayList对象 ///// </summary> ///// <param name="qp">查询类</param> ///// <param name="RecordCount">返回记录总数</param> ///// <returns>sys_UserTable实体类的ArrayList对象</returns> //public override ArrayList sys_UserList(QueryParam qp, out int RecordCount) //{ // PopulateDelegate mypd = new PopulateDelegate(base.Populatesys_User); // return this.GetObjectList(mypd, qp, out RecordCount); //} //#endregion #region "sys_User (用户表) - SQLDataProvider" /// <summary> /// 新增/删除/修改 sys_User (用户表) /// </summary> /// <param name="fam">sys_UserTable实体类(用户表)</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public override int sys_UserInsertUpdate(sys_UserTable fam) { Int32 rInt = -1; using (SqlConnection Conn = GetSqlConnection()) { SqlCommand cmd = new SqlCommand("dbo.sys_UserInsertUpdateDelete", Conn); cmd.CommandType = CommandType.StoredProcedure; //设置参数 cmd.Parameters.Add("@DataTable_Action_", SqlDbType.VarChar).Value = fam.DB_Option_Action_.ToString(); //操作方法 Insert:增加 Update:修改 Delete:删除 cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = fam.UserID; //用户ID号 cmd.Parameters.Add("@U_LoginName", SqlDbType.NVarChar).Value = fam.U_LoginName; //登陆名 cmd.Parameters.Add("@U_Password", SqlDbType.VarChar).Value = fam.U_Password; //密码md5加密字符 cmd.Parameters.Add("@U_CName", SqlDbType.NVarChar).Value = fam.U_CName; //中文姓名 cmd.Parameters.Add("@U_EName", SqlDbType.VarChar).Value = fam.U_EName; //英文名 cmd.Parameters.Add("@U_GroupID", SqlDbType.Int).Value = fam.U_GroupID; //部门ID号与sys_Group表中GroupID关联 cmd.Parameters.Add("@U_Email", SqlDbType.VarChar).Value = fam.U_Email; //电子邮件 cmd.Parameters.Add("@U_Type", SqlDbType.TinyInt).Value = fam.U_Type; //用户类型0:超级用户1:普通用户 cmd.Parameters.Add("@U_Status", SqlDbType.TinyInt).Value = fam.U_Status; //当前状态0:正常 1:禁止登陆 2:删除 cmd.Parameters.Add("@U_Licence", SqlDbType.VarChar).Value = fam.U_Licence; //用户序列号 cmd.Parameters.Add("@U_Mac", SqlDbType.VarChar).Value = fam.U_Mac; //锁定机器硬件地址 cmd.Parameters.Add("@U_Remark", SqlDbType.NVarChar).Value = fam.U_Remark; //备注说明 cmd.Parameters.Add("@U_IDCard", SqlDbType.VarChar).Value = fam.U_IDCard; //身份证号码 cmd.Parameters.Add("@U_Sex", SqlDbType.TinyInt).Value = fam.U_Sex; //性别1:男0:女 if (fam.U_BirthDay.HasValue) cmd.Parameters.Add("@U_BirthDay", SqlDbType.DateTime).Value = fam.U_BirthDay; //出生日期 else cmd.Parameters.Add("@U_BirthDay", SqlDbType.DateTime).Value = DBNull.Value; //出生日期 cmd.Parameters.Add("@U_MobileNo", SqlDbType.VarChar).Value = fam.U_MobileNo; //手机号 cmd.Parameters.Add("@U_UserNO", SqlDbType.VarChar).Value = fam.U_UserNO; //员工编号 if (fam.U_WorkStartDate.HasValue) cmd.Parameters.Add("@U_WorkStartDate", SqlDbType.DateTime).Value = fam.U_WorkStartDate; //到职日期 else cmd.Parameters.Add("@U_WorkStartDate", SqlDbType.DateTime).Value = DBNull.Value; //到职日期 if (fam.U_WorkEndDate.HasValue) cmd.Parameters.Add("@U_WorkEndDate", SqlDbType.DateTime).Value = fam.U_WorkEndDate; //离职日期 else cmd.Parameters.Add("@U_WorkEndDate", SqlDbType.DateTime).Value = DBNull.Value; //离职日期 cmd.Parameters.Add("@U_CompanyMail", SqlDbType.VarChar).Value = fam.U_CompanyMail; //公司邮件地址 cmd.Parameters.Add("@U_Title", SqlDbType.Int).Value = fam.U_Title; //职称与应用字段关联 cmd.Parameters.Add("@U_Extension", SqlDbType.VarChar).Value = fam.U_Extension; //分机号 cmd.Parameters.Add("@U_HomeTel", SqlDbType.VarChar).Value = fam.U_HomeTel; //家中电话 cmd.Parameters.Add("@U_PhotoUrl", SqlDbType.NVarChar).Value = fam.U_PhotoUrl; //用户照片网址 cmd.Parameters.Add("@U_DateTime", SqlDbType.DateTime).Value = fam.U_DateTime; //操作时间 cmd.Parameters.Add("@U_LastIP", SqlDbType.VarChar).Value = fam.U_LastIP; //最后访问IP cmd.Parameters.Add("@U_LastDateTime", SqlDbType.DateTime).Value = fam.U_LastDateTime; //最后访问时间 cmd.Parameters.Add("@U_ExtendField", SqlDbType.NText).Value = fam.U_ExtendField; //扩展字段 cmd.Parameters.Add("@SignPicture", SqlDbType.VarChar).Value = fam.SignPicture; //SignPicture cmd.Parameters.Add("@SignPassword", SqlDbType.VarChar).Value = fam.SignPassword; //SignPassword Conn.Open(); rInt = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
/// <summary> /// ��ʼ������ /// </summary> /// <param name="ut"></param> private void OnStartData(sys_UserTable ut) { #region "��ʾ����" U_LoginName_Value.Text = ut.U_LoginName; U_Password_Value.Text = "******"; U_Type_Value.Text = BusinessFacade.sys_UserType(ut.U_Type); if (UserData.GetUserDate.U_Type == 0) { U_Type.Items[1].Enabled = true; U_Type.Items[2].Enabled = true; } else if (UserData.GetUserDate.U_Type == 1) { U_Type.Items[1].Enabled = true; } U_Status_Value.Text = ut.U_Status == 0 ? "����" : "��ֹ"; U_GroupID_Value.Text = BusinessFacade.sys_GroupDisp(ut.U_GroupID).G_CName; #endregion #region "��������" U_LoginName.Text = ut.U_LoginName; U_Password.Attributes["value"] = ut.U_Password; ListItem li = U_Type.Items.FindByValue(ut.U_Type.ToString()); if (li != null) li.Selected = true; ListItem li1 = U_Status.Items.FindByValue(ut.U_Status.ToString()); if (li1 != null) li1.Selected = true; U_GroupID.Value = ut.U_GroupID.ToString(); U_GroupID_Txt.Value = BusinessFacade.sys_GroupDisp(ut.U_GroupID).G_CName; #endregion }