Esempio n. 1
0
 private void ShowInfo(int R_UserID, int R_RoleID)
 {
     Maticsoft.BLL.sys_UserRoles   bll   = new Maticsoft.BLL.sys_UserRoles();
     Maticsoft.Model.sys_UserRoles model = bll.GetModel(R_UserID, R_RoleID);
     this.lblR_UserID.Text = model.R_UserID.ToString();
     this.lblR_RoleID.Text = model.R_RoleID.ToString();
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtR_UserID.Text))
            {
                strErr += "用户ID与sys_User表中格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtR_RoleID.Text))
            {
                strErr += "用户所属角色ID与Sys_Ro格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int R_UserID = int.Parse(this.txtR_UserID.Text);
            int R_RoleID = int.Parse(this.txtR_RoleID.Text);

            Maticsoft.Model.sys_UserRoles model = new Maticsoft.Model.sys_UserRoles();
            model.R_UserID = R_UserID;
            model.R_RoleID = R_RoleID;

            Maticsoft.BLL.sys_UserRoles bll = new Maticsoft.BLL.sys_UserRoles();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.sys_UserRoles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sys_UserRoles set ");
#warning 系统发现缺少更新的字段,请手工确认如此更新是否正确!
            strSql.Append("R_UserID=@R_UserID,");
            strSql.Append("R_RoleID=@R_RoleID");
            strSql.Append(" where R_UserID=@R_UserID and R_RoleID=@R_RoleID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@R_UserID", SqlDbType.Int, 4),
                new SqlParameter("@R_RoleID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.R_UserID;
            parameters[1].Value = model.R_RoleID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.sys_UserRoles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sys_UserRoles(");
            strSql.Append("R_UserID,R_RoleID)");
            strSql.Append(" values (");
            strSql.Append("@R_UserID,@R_RoleID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@R_UserID", SqlDbType.Int, 4),
                new SqlParameter("@R_RoleID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.R_UserID;
            parameters[1].Value = model.R_RoleID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_UserRoles GetModel(int R_UserID, int R_RoleID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 R_UserID,R_RoleID from sys_UserRoles ");
            strSql.Append(" where R_UserID=@R_UserID and R_RoleID=@R_RoleID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@R_UserID", SqlDbType.Int, 4),
                new SqlParameter("@R_RoleID", SqlDbType.Int, 4)
            };
            parameters[0].Value = R_UserID;
            parameters[1].Value = R_RoleID;

            Maticsoft.Model.sys_UserRoles model = new Maticsoft.Model.sys_UserRoles();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_UserRoles DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_UserRoles model=new Maticsoft.Model.sys_UserRoles();
     if (row != null)
     {
         if(row["R_UserID"]!=null && row["R_UserID"].ToString()!="")
         {
             model.R_UserID=int.Parse(row["R_UserID"].ToString());
         }
         if(row["R_RoleID"]!=null && row["R_RoleID"].ToString()!="")
         {
             model.R_RoleID=int.Parse(row["R_RoleID"].ToString());
         }
     }
     return model;
 }
Esempio n. 7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.sys_UserRoles DataRowToModel(DataRow row)
 {
     Maticsoft.Model.sys_UserRoles model = new Maticsoft.Model.sys_UserRoles();
     if (row != null)
     {
         if (row["R_UserID"] != null && row["R_UserID"].ToString() != "")
         {
             model.R_UserID = int.Parse(row["R_UserID"].ToString());
         }
         if (row["R_RoleID"] != null && row["R_RoleID"].ToString() != "")
         {
             model.R_RoleID = int.Parse(row["R_RoleID"].ToString());
         }
     }
     return(model);
 }
Esempio n. 8
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int R_UserID=int.Parse(this.lblR_UserID.Text);
            int R_RoleID=int.Parse(this.lblR_RoleID.Text);

            Maticsoft.Model.sys_UserRoles model=new Maticsoft.Model.sys_UserRoles();
            model.R_UserID=R_UserID;
            model.R_RoleID=R_RoleID;

            Maticsoft.BLL.sys_UserRoles bll=new Maticsoft.BLL.sys_UserRoles();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Esempio n. 9
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int R_UserID = int.Parse(this.lblR_UserID.Text);
            int R_RoleID = int.Parse(this.lblR_RoleID.Text);


            Maticsoft.Model.sys_UserRoles model = new Maticsoft.Model.sys_UserRoles();
            model.R_UserID = R_UserID;
            model.R_RoleID = R_RoleID;

            Maticsoft.BLL.sys_UserRoles bll = new Maticsoft.BLL.sys_UserRoles();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Esempio n. 10
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.sys_UserRoles GetModel(int R_UserID,int R_RoleID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 R_UserID,R_RoleID from sys_UserRoles ");
            strSql.Append(" where R_UserID=@R_UserID and R_RoleID=@R_RoleID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@R_UserID", SqlDbType.Int,4),
                    new SqlParameter("@R_RoleID", SqlDbType.Int,4)			};
            parameters[0].Value = R_UserID;
            parameters[1].Value = R_RoleID;

            Maticsoft.Model.sys_UserRoles model=new Maticsoft.Model.sys_UserRoles();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Esempio n. 11
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"));
        }