示例#1
0
文件: sys_User.cs 项目: hezejiang/EHR
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_User GetModel(int UserID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 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,U_LoginType,U_HospitalGroupID,U_AccessToken from sys_User ");
            strSql.Append(" where [email protected]");
            SqlParameter[] parameters = {
                    new SqlParameter("@UserID", SqlDbType.Int,4)
            };
            parameters[0].Value = UserID;

            Maticsoft.Model.sys_User model=new Maticsoft.Model.sys_User();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
示例#2
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.sys_User sysUser_bll = new Maticsoft.BLL.sys_User();
            Maticsoft.Model.sys_User sysUser_model = sysUser_bll.GetModel(UserID);

            Maticsoft.BLL.record_UserBaseInfo record_UserBaseInfo_bll = new Maticsoft.BLL.record_UserBaseInfo();
            Maticsoft.Model.record_UserBaseInfo record_UserBaseInfo_model = record_UserBaseInfo_bll.GetModel(UserID);
            if (sysUser_model == null)
            {
                sysUser_model = new Maticsoft.Model.sys_User();
            }
            if (record_UserBaseInfo_model == null)
            {
                record_UserBaseInfo_model = new Maticsoft.Model.record_UserBaseInfo();
            }

            sysUser_model.U_IDCard = (string)Common.sink(this.U_IDCard.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            sysUser_model.U_CName = (string)Common.sink(this.U_CName.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_Hometown = (string)Common.sink(this.U_Hometown.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_CurrentAddress = (string)Common.sink(this.U_CurrentAddress.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            sysUser_model.U_Sex = Convert.ToInt32(this.U_Sex.SelectedValue);
            record_UserBaseInfo_model.U_NationID = Convert.ToInt32(this.U_NationID.SelectedValue);
            record_UserBaseInfo_model.U_MarriageStatus = Convert.ToInt32(this.U_MarriageStatus.SelectedValue);
            record_UserBaseInfo_model.U_BloodType = Convert.ToInt32(this.U_BloodType.SelectedValue);
            sysUser_model.U_MobileNo = (string)Common.sink(this.U_MobileNo.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_Committee = Convert.ToInt32(Common.sink(this.U_Committee.UniqueID, MethodType.Post, 0, 0, DataType.Str));
            record_UserBaseInfo_model.U_PermanentType = Convert.ToInt32(this.U_PermanentType.SelectedValue);
            record_UserBaseInfo_model.U_Education = Convert.ToInt32(this.U_Education.SelectedValue);
            record_UserBaseInfo_model.U_WorkingUnits = (string)Common.sink(this.U_WorkingUnits.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_WorkingContactName = (string)Common.sink(this.U_WorkingContactName.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_WorkingContactTel = (string)Common.sink(this.U_WorkingContactTel.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_PaymentType = this.U_PaymentType.SelectedValue;  //这里要改为多选
            record_UserBaseInfo_model.U_SocialNO = (string)Common.sink(this.U_SocialNO.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_MedicalNO = (string)Common.sink(this.U_MedicalNO.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_FamilyCode = (string)Common.sink(this.U_FamilyCode.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            record_UserBaseInfo_model.U_RelationShip = Convert.ToInt32(this.U_RelationShip.SelectedValue);
            record_UserBaseInfo_model.U_ResponsibilityUserID = Convert.ToInt32(Common.sink(this.U_ResponsibilityUserID.UniqueID, MethodType.Post, 0, 0, DataType.Str));
            record_UserBaseInfo_model.U_AuditStatus = Convert.ToInt32(this.U_AuditStatus.SelectedValue);
            record_UserBaseInfo_model.U_FilingUnits = Convert.ToInt32(Common.sink(this.U_FilingUnits.UniqueID, MethodType.Post, 0, 0, DataType.Str));
            record_UserBaseInfo_model.U_FilingUserID = Convert.ToInt32(Common.sink(this.U_FilingUserID.UniqueID, MethodType.Post, 0, 0, DataType.Str));

            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    //如果是增加操作,就调用Add方法
                    if (!sysUser_bll.isExist(sysUser_model))
                    {
                        sysUser_model.U_Password = Common.md5(sysUser_model.U_IDCard, 32);  //初始密码为身份证号
                        string year = sysUser_model.U_IDCard.Substring(6, 4);
                        string month = sysUser_model.U_IDCard.Substring(10, 2);
                        string date = sysUser_model.U_IDCard.Substring(12, 2);
                        string result = year + "-" + month + "-" + date;
                        sysUser_model.U_LoginName = sysUser_model.U_IDCard;
                        sysUser_model.U_BirthDay = Convert.ToDateTime(result);
                        sysUser_model.U_DateTime = sysUser_model.U_LastDateTime = sysUser_model.U_WorkStartDate = sysUser_model.U_WorkEndDate = DateTime.Now;
                        sysUser_model.U_LastIP = Common.GetIPAddress();
                        sysUser_model.U_Type = 1;
                        sysUser_model.U_Status = 0;
                        record_UserBaseInfo_model.UserID = sysUser_bll.Add(sysUser_model);
                        record_UserBaseInfo_model.U_FlingTime = DateTime.Now;
                        record_UserBaseInfo_bll.Add(record_UserBaseInfo_model);
                        Maticsoft.BLL.sys_UserRoles sys_UserRoles_bll = new Maticsoft.BLL.sys_UserRoles();
                        Maticsoft.Model.sys_UserRoles sys_UserRoles_model = new Maticsoft.Model.sys_UserRoles();
                        sys_UserRoles_model.R_UserID = record_UserBaseInfo_model.UserID;
                        sys_UserRoles_model.R_RoleID = 1; //初始为普通用户
                    }
                    else
                    {
                        EventMessage.MessageBox(1, "操作失败", string.Format("个人健康档案号{0}已存在!", sysUser_model.U_IDCard), Icon_Type.Alert, Common.GetHomeBaseUrl("InfoManager.aspx?CMD=New"));
                    }
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    sysUser_bll.Update(sysUser_model);
                    record_UserBaseInfo_bll.Update(record_UserBaseInfo_model);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
                EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", UserID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
示例#3
0
文件: sys_User.cs 项目: hezejiang/EHR
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_User DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_User model=new Maticsoft.Model.sys_User();
     if (row != null)
     {
         if(row["UserID"]!=null && row["UserID"].ToString()!="")
         {
             model.UserID=int.Parse(row["UserID"].ToString());
         }
         if(row["U_LoginName"]!=null)
         {
             model.U_LoginName=row["U_LoginName"].ToString();
         }
         if(row["U_Password"]!=null)
         {
             model.U_Password=row["U_Password"].ToString();
         }
         if(row["U_CName"]!=null)
         {
             model.U_CName=row["U_CName"].ToString();
         }
         if(row["U_EName"]!=null)
         {
             model.U_EName=row["U_EName"].ToString();
         }
         if(row["U_GroupID"]!=null && row["U_GroupID"].ToString()!="")
         {
             model.U_GroupID=int.Parse(row["U_GroupID"].ToString());
         }
         if(row["U_Email"]!=null)
         {
             model.U_Email=row["U_Email"].ToString();
         }
         if(row["U_Type"]!=null && row["U_Type"].ToString()!="")
         {
             model.U_Type=int.Parse(row["U_Type"].ToString());
         }
         if(row["U_Status"]!=null && row["U_Status"].ToString()!="")
         {
             model.U_Status=int.Parse(row["U_Status"].ToString());
         }
         if(row["U_Licence"]!=null)
         {
             model.U_Licence=row["U_Licence"].ToString();
         }
         if(row["U_Mac"]!=null)
         {
             model.U_Mac=row["U_Mac"].ToString();
         }
         if(row["U_Remark"]!=null)
         {
             model.U_Remark=row["U_Remark"].ToString();
         }
         if(row["U_IDCard"]!=null)
         {
             model.U_IDCard=row["U_IDCard"].ToString();
         }
         if(row["U_Sex"]!=null && row["U_Sex"].ToString()!="")
         {
             model.U_Sex=int.Parse(row["U_Sex"].ToString());
         }
         if(row["U_BirthDay"]!=null && row["U_BirthDay"].ToString()!="")
         {
             model.U_BirthDay=DateTime.Parse(row["U_BirthDay"].ToString());
         }
         if(row["U_MobileNo"]!=null)
         {
             model.U_MobileNo=row["U_MobileNo"].ToString();
         }
         if(row["U_UserNO"]!=null)
         {
             model.U_UserNO=row["U_UserNO"].ToString();
         }
         if(row["U_WorkStartDate"]!=null && row["U_WorkStartDate"].ToString()!="")
         {
             model.U_WorkStartDate=DateTime.Parse(row["U_WorkStartDate"].ToString());
         }
         if(row["U_WorkEndDate"]!=null && row["U_WorkEndDate"].ToString()!="")
         {
             model.U_WorkEndDate=DateTime.Parse(row["U_WorkEndDate"].ToString());
         }
         if(row["U_CompanyMail"]!=null)
         {
             model.U_CompanyMail=row["U_CompanyMail"].ToString();
         }
         if(row["U_Title"]!=null && row["U_Title"].ToString()!="")
         {
             model.U_Title=int.Parse(row["U_Title"].ToString());
         }
         if(row["U_Extension"]!=null)
         {
             model.U_Extension=row["U_Extension"].ToString();
         }
         if(row["U_HomeTel"]!=null)
         {
             model.U_HomeTel=row["U_HomeTel"].ToString();
         }
         if(row["U_PhotoUrl"]!=null)
         {
             model.U_PhotoUrl=row["U_PhotoUrl"].ToString();
         }
         if(row["U_DateTime"]!=null && row["U_DateTime"].ToString()!="")
         {
             model.U_DateTime=DateTime.Parse(row["U_DateTime"].ToString());
         }
         if(row["U_LastIP"]!=null)
         {
             model.U_LastIP=row["U_LastIP"].ToString();
         }
         if(row["U_LastDateTime"]!=null && row["U_LastDateTime"].ToString()!="")
         {
             model.U_LastDateTime=DateTime.Parse(row["U_LastDateTime"].ToString());
         }
         if(row["U_ExtendField"]!=null)
         {
             model.U_ExtendField=row["U_ExtendField"].ToString();
         }
         if(row["U_LoginType"]!=null)
         {
             model.U_LoginType=row["U_LoginType"].ToString();
         }
         if(row["U_HospitalGroupID"]!=null && row["U_HospitalGroupID"].ToString()!="")
         {
             model.U_HospitalGroupID=int.Parse(row["U_HospitalGroupID"].ToString());
         }
         if(row["U_AccessToken"]!=null)
         {
             model.U_AccessToken=row["U_AccessToken"].ToString();
         }
     }
     return model;
 }
示例#4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtU_LoginName.Text.Trim().Length==0)
            {
                strErr+="登陆名不能为空!\\n";
            }
            if(this.txtU_Password.Text.Trim().Length==0)
            {
                strErr+="密码md5加密字符不能为空!\\n";
            }
            if(this.txtU_CName.Text.Trim().Length==0)
            {
                strErr+="中文姓名不能为空!\\n";
            }
            if(this.txtU_EName.Text.Trim().Length==0)
            {
                strErr+="英文名不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtU_GroupID.Text))
            {
                strErr+="部门ID号与sys_Group表中GroupID关联格式错误!\\n";
            }
            if(this.txtU_Email.Text.Trim().Length==0)
            {
                strErr+="电子邮件不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtU_Type.Text))
            {
                strErr+="用户类型0:超级用户1:普通用格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtU_Status.Text))
            {
                strErr+="当前状态0:正常 1:禁止登陆格式错误!\\n";
            }
            if(this.txtU_Licence.Text.Trim().Length==0)
            {
                strErr+="用户序列号不能为空!\\n";
            }
            if(this.txtU_Mac.Text.Trim().Length==0)
            {
                strErr+="锁定机器硬件地址不能为空!\\n";
            }
            if(this.txtU_Remark.Text.Trim().Length==0)
            {
                strErr+="备注说明不能为空!\\n";
            }
            if(this.txtU_IDCard.Text.Trim().Length==0)
            {
                strErr+="身份证号码不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtU_Sex.Text))
            {
                strErr+="性别1:男0:女格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txtU_BirthDay.Text))
            {
                strErr+="出生日期格式错误!\\n";
            }
            if(this.txtU_MobileNo.Text.Trim().Length==0)
            {
                strErr+="手机号不能为空!\\n";
            }
            if(this.txtU_UserNO.Text.Trim().Length==0)
            {
                strErr+="员工编号不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtU_WorkStartDate.Text))
            {
                strErr+="到职日期格式错误!\\n";
            }
            if(!PageValidate.IsDateTime(txtU_WorkEndDate.Text))
            {
                strErr+="离职日期格式错误!\\n";
            }
            if(this.txtU_CompanyMail.Text.Trim().Length==0)
            {
                strErr+="公司邮件地址不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtU_Title.Text))
            {
                strErr+="职称与应用字段关联格式错误!\\n";
            }
            if(this.txtU_Extension.Text.Trim().Length==0)
            {
                strErr+="分机号不能为空!\\n";
            }
            if(this.txtU_HomeTel.Text.Trim().Length==0)
            {
                strErr+="家中电话不能为空!\\n";
            }
            if(this.txtU_PhotoUrl.Text.Trim().Length==0)
            {
                strErr+="用户照片网址不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtU_DateTime.Text))
            {
                strErr+="操作时间格式错误!\\n";
            }
            if(this.txtU_LastIP.Text.Trim().Length==0)
            {
                strErr+="最后访问IP不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtU_LastDateTime.Text))
            {
                strErr+="最后访问时间格式错误!\\n";
            }
            if(this.txtU_ExtendField.Text.Trim().Length==0)
            {
                strErr+="扩展字段不能为空!\\n";
            }
            if(this.txtU_LoginType.Text.Trim().Length==0)
            {
                strErr+="登入类型(为空系统认证,其它值不能为空!\\n";
            }
            if(!PageValidate.IsNumber(txtU_HospitalGroupID.Text))
            {
                strErr+="医院部门ID号与sys_Group表中GroupID关联格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int UserID=int.Parse(this.lblUserID.Text);
            string U_LoginName=this.txtU_LoginName.Text;
            string U_Password=this.txtU_Password.Text;
            string U_CName=this.txtU_CName.Text;
            string U_EName=this.txtU_EName.Text;
            int U_GroupID=int.Parse(this.txtU_GroupID.Text);
            string U_Email=this.txtU_Email.Text;
            int U_Type=int.Parse(this.txtU_Type.Text);
            int U_Status=int.Parse(this.txtU_Status.Text);
            string U_Licence=this.txtU_Licence.Text;
            string U_Mac=this.txtU_Mac.Text;
            string U_Remark=this.txtU_Remark.Text;
            string U_IDCard=this.txtU_IDCard.Text;
            int U_Sex=int.Parse(this.txtU_Sex.Text);
            DateTime U_BirthDay=DateTime.Parse(this.txtU_BirthDay.Text);
            string U_MobileNo=this.txtU_MobileNo.Text;
            string U_UserNO=this.txtU_UserNO.Text;
            DateTime U_WorkStartDate=DateTime.Parse(this.txtU_WorkStartDate.Text);
            DateTime U_WorkEndDate=DateTime.Parse(this.txtU_WorkEndDate.Text);
            string U_CompanyMail=this.txtU_CompanyMail.Text;
            int U_Title=int.Parse(this.txtU_Title.Text);
            string U_Extension=this.txtU_Extension.Text;
            string U_HomeTel=this.txtU_HomeTel.Text;
            string U_PhotoUrl=this.txtU_PhotoUrl.Text;
            DateTime U_DateTime=DateTime.Parse(this.txtU_DateTime.Text);
            string U_LastIP=this.txtU_LastIP.Text;
            DateTime U_LastDateTime=DateTime.Parse(this.txtU_LastDateTime.Text);
            string U_ExtendField=this.txtU_ExtendField.Text;
            string U_LoginType=this.txtU_LoginType.Text;
            int U_HospitalGroupID=int.Parse(this.txtU_HospitalGroupID.Text);

            Maticsoft.Model.sys_User model=new Maticsoft.Model.sys_User();
            model.UserID=UserID;
            model.U_LoginName=U_LoginName;
            model.U_Password=U_Password;
            model.U_CName=U_CName;
            model.U_EName=U_EName;
            model.U_GroupID=U_GroupID;
            model.U_Email=U_Email;
            model.U_Type=U_Type;
            model.U_Status=U_Status;
            model.U_Licence=U_Licence;
            model.U_Mac=U_Mac;
            model.U_Remark=U_Remark;
            model.U_IDCard=U_IDCard;
            model.U_Sex=U_Sex;
            model.U_BirthDay=U_BirthDay;
            model.U_MobileNo=U_MobileNo;
            model.U_UserNO=U_UserNO;
            model.U_WorkStartDate=U_WorkStartDate;
            model.U_WorkEndDate=U_WorkEndDate;
            model.U_CompanyMail=U_CompanyMail;
            model.U_Title=U_Title;
            model.U_Extension=U_Extension;
            model.U_HomeTel=U_HomeTel;
            model.U_PhotoUrl=U_PhotoUrl;
            model.U_DateTime=U_DateTime;
            model.U_LastIP=U_LastIP;
            model.U_LastDateTime=U_LastDateTime;
            model.U_ExtendField=U_ExtendField;
            model.U_LoginType=U_LoginType;
            model.U_HospitalGroupID=U_HospitalGroupID;

            Maticsoft.BLL.sys_User bll=new Maticsoft.BLL.sys_User();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }