Example #1
0
        public static void ImportAdminNUser()
        {
            ImportSqlServerUtility sql = new ImportSqlServerUtility();

            string strsql = "select * from users ";

            DataSet ds = sql.ExecuteSqlDataSet(strsql);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User();

                    user.UserID = ds.Tables[0].Rows[i][2].ToString().Length > 0 ? ds.Tables[0].Rows[i][2].ToString() : ds.Tables[0].Rows[i][9].ToString();
                    user.Password = ds.Tables[0].Rows[i][3].ToString().Length > 0 ? ds.Tables[0].Rows[i][3].ToString() : "123456";
                    user.UnitID = ConvertUnitNameToId(ds.Tables[0].Rows[i][6].ToString().Trim());
                    user.Name = ds.Tables[0].Rows[i][9].ToString();
                    user.Phone = ds.Tables[0].Rows[i][17].ToString();
                    if (user.UnitID != Guid.Empty)
                    {
                        // 单位用户
                        user.UserType = GetUserType(user.UnitID);
                    }
                    else
                    {
                        // 普通用户
                        user.UserType = 1;
                    }

                    user.UserType = ds.Tables[0].Rows[i][10].ToString() == "True" ? 5 : user.UserType;
                    user.Save();
                }
            }
        }
Example #2
0
 /// <summary>
 /// 删除已选人员
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnDel_Click(object sender, EventArgs e)
 {
     try
     {
         CheckBox cb;
         CY.CSTS.Core.Business.User u;
         for (int i = 0; i < gvPeopleInUnit.Rows.Count; i++)
         {
             cb = (CheckBox)gvPeopleInUnit.Rows[i].FindControl("chb");
             if (cb.Checked)
             {
                 Guid id = new Guid(gvPeopleInUnit.DataKeys[i].Value.ToString());
                 u = CY.CSTS.Core.Business.User.Load(id);
                 if (u != null)
                 {
                     u.UnitID = Guid.Empty;
                     u.UserType = 1;
                     u.Save();
                 }
             }
         }
         gvAllNormalPeopleDataBind();
         gvPeopleInUnitDataBind();
         Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "删除成功!", "<script>window.location.href='UnitPeople.aspx'</script>");
     }
     catch (Exception ex)
     {
         lbError.Text = ex.Message;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] != null)
     {
         U = (CY.CSTS.Core.Business.User)Session["User"];
     }
     else
     {
         Response.Redirect("../TempLogin.aspx");
     }
     if (!IsPostBack)
     {
         bindGv();
     }
 }
Example #4
0
        protected virtual CY.CSTS.Core.Business.User GetUser()
        {
            CY.CSTS.Core.Business.User User = null;
            try
            {
                if (Session["User"] is CY.CSTS.Core.Business.User)
                {
                    User = Session["User"] as CY.CSTS.Core.Business.User;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
            if (User == null)
            {
                User = new CY.CSTS.Core.Business.User();
            }
            return User;
        }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] != null)
     {
         U = (CY.CSTS.Core.Business.User)Session["User"];
     }
     if (!IsPostBack)
     {
         BindDetail();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                U = (CY.CSTS.Core.Business.User)Session["User"];
            }
            else
            {
                Response.Redirect("../TempLogin.aspx");
            }
            CY.CSTS.Core.Business.User user = CY.CSTS.Core.Business.User.Load(U.Id);
            if (user != null)
            {
                if (user.UserType != 4)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('您没有权限评分!');</script>");
                    return;
                }
            }
            if (!IsPostBack)
            {
                CY.CSTS.Core.Business.StimulationCheck check = CY.CSTS.Core.Business.StimulationCheck.getNew();

                if (check == null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('激励考评已关闭!');</script>");
                    return;
                }
                else
                {
                    CY.CSTS.Core.Business.StimulationType type = CY.CSTS.Core.Business.StimulationType.SelecByWhere("[StimulationId]='" + check.Id + "' and [StimulatedType]=2");
                    if (type == null)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                        return;
                    }
                    if (Context.Request.QueryString["tab"] != null && Context.Request.QueryString["tab"] != "")
                    {
                        hdtype.Value = Context.Request.QueryString["tab"];
                    }
                    else
                    {
                        hdtype.Value = "0";
                    }
                    bindtable();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                U = (CY.CSTS.Core.Business.User)Session["User"];
            }
            if (string.IsNullOrEmpty(Context.Request.QueryString["Id"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["Id"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }
            else
            {
                jrId = new Guid(Context.Request.QueryString["Id"]);

                if (listUP.Where(Items => Items.Id == 47).ToList().Count() > 0)
                {
                    step2permission = true;
                }
                else
                {
                    step2permission = false;
                }

                if (!IsPostBack)
                {
                    hdId.Value = jrId.ToString();
                    bindCtr(jrId);
                    bindtable();
                }
            }
        }
Example #8
0
        public static void ImportUser2()
        {
            try
            {
                ImportSqlServerUtility isql = new ImportSqlServerUtility();

                string strsql = "select * from  Users";

                DataSet ds = isql.ExecuteSqlDataSet(strsql);

                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.Password = ds.Tables[0].Rows[i][0].ToString();

                        //user.UnitID = ds.Tables[0].Rows[i][0].ToString();

                        //user.Name = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();

                        //user.UserID = ds.Tables[0].Rows[i][0].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
        public static void ImportExpert()
        {
            ImportSqlServerUtility isql = new ImportSqlServerUtility();

            string strsql = "select * from expert";

            DataSet ds = isql.ExecuteSqlDataSet(strsql);

            SqlServerUtility sql = new SqlServerUtility();

            RelationSqlServerUtility rsql = new RelationSqlServerUtility();

            string insertsql = "insert into ruser(old,new) values('{0}','{1}')";

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User();

                    // 性别
                    user.Gender = ds.Tables[0].Rows[i][1].ToString();

                    //真名
                    user.Name = ds.Tables[0].Rows[i][2].ToString();

                    //局长
                    user.Duty = ds.Tables[0].Rows[i][3].ToString();

                    //教授
                    user.PostRankID = TransferTitltId(ds.Tables[0].Rows[i][4].ToString());

                    //简介
                    user.Resume = ds.Tables[0].Rows[i][5].ToString();

                    // 专长
                    user.Specialty = ds.Tables[0].Rows[i][7].ToString();

                    //研究领域
                    //   user.FeildID = ds.Tables[0].Rows[i][0].ToString();

                    //教育程度
                    user.EducationID = TransferEducationId(ds.Tables[0].Rows[i][8].ToString());

                    user.RegDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][9].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][9].ToString()) : DateTime.MinValue;

                    user.BirthDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][10].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][10].ToString()) : DateTime.MinValue;

                    user.PicURL = ds.Tables[0].Rows[i][11].ToString();

                    user.Email = ds.Tables[0].Rows[i][12].ToString();

                    user.Fax = ds.Tables[0].Rows[i][13].ToString();

                    user.Phone = ds.Tables[0].Rows[i][14].ToString();

                    //user.UnitID = ConvertUnitNameToId(ds.Tables[0].Rows[i][15].ToString());

                    user.Unit = ds.Tables[0].Rows[i][15].ToString();

                    // adiwan
                    user.UserID = ds.Tables[0].Rows[i][2].ToString();

                    user.Password = "******";

                    user.UserType = 4;

                    user.Save();

                    //TransferUserFieldRelation(ds.Tables[0].Rows[i][6].ToString(), user.Id);

                    rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), user.Id));

                }
            }
        }
Example #10
0
        private string HandlerData(HttpContext context)
        {
            StringBuilder returnvalue = new StringBuilder();

            returnvalue.Append("{");
            try
            {
                string UnitId = context.Request["UnitId"];
                string UserId = context.Request["UserId"];
                string UserName = context.Request["UserName"];
                string UserPass = context.Request["UserPass"];
                string UserEdu = context.Request["UserEdu"];
                string UserSex = context.Request["UserSex"];
                string UserPost = context.Request["UserPost"];
                CY.CSTS.Core.Business.User u = new CY.CSTS.Core.Business.User();
                u.UserID = UserId;
                u.Password = UserPass;
                u.Name = UserName;
                if (!UserEdu.Equals(String.Empty) && CY.Utility.Common.StringHelper.IsGuid(UserEdu))
                {
                    u.EducationID = new Guid(UserEdu);
                }
                // 职称
                if (UserPost.Trim() != "")
                {
                    List<CY.CSTS.Core.Business.UserPostRank> postRankList = CY.CSTS.Core.Business.UserPostRank.GetAllUserPostRank()
                        as List<CY.CSTS.Core.Business.UserPostRank>;
                    postRankList = postRankList.Where(Items => Items.PostRankName == UserPost.Trim()).ToList();
                    Guid postId = new Guid();
                    if (postRankList.Count == 0)
                    {
                        CY.CSTS.Core.Business.UserPostRank post = new CY.CSTS.Core.Business.UserPostRank();
                        post.PostRankName = UserPost.Trim();
                        post.Save();
                        postId = post.Id;
                    }
                    else
                    {
                        postId = postRankList[0].Id;
                    }
                    u.PostRankID = postId;
                }
                if (!UnitId.Equals(String.Empty) && CY.Utility.Common.StringHelper.IsGuid(UnitId))
                {
                    u.UnitID = new Guid(UnitId);

                    CY.CSTS.Core.Business.UnitInfo ui = CY.CSTS.Core.Business.UnitInfo.Load(u.UnitID);
                    if (ui == null)
                    {
                        throw (new Exception("单位错误"));
                    }
                    else
                    {
                        if (ui.IsCooperantUnit == 2) //分中心
                        {
                            u.UserType = 2;
                        }
                        else if (ui.IsCooperantUnit == 1) //协作单位
                        {
                            u.UserType = 3;
                        }
                    }
                }
                else
                {
                    throw (new Exception("单位错误"));
                }
                u.Gender = UserSex;
                u.Save();
                returnvalue.Append("status:'0',");
                returnvalue.Append("message:'ok'");
            }
            catch (Exception ex)
            {
                returnvalue.Append("status:'1',");
                returnvalue.Append("message:'发生异常'");
            }
            finally
            {
                returnvalue.Append("}");
            }
            return returnvalue.ToString();
        }
Example #11
0
        protected void Regist_OnClick(object sender, EventArgs e)
        {
            spanErr.InnerText = "";
            #region validate
            if (TBXUserPsw.Text.Trim()!=TBXUserPswConfirm.Text.Trim())
            {
                spanErr.InnerText = "两次密码输入不一致";
                //Page.ClientScript.RegisterClientScriptBlock(GetType(),"err","<script>alert('两次密码输入不一致');</script>");
                return;
            }
            if (TBXBirthDate.Text.Trim().Length == 0)
            {
                spanErr.InnerText = "请输入出生日期";
                //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('请输入出生日期');</script>");
                return;
            }
            DateTime birthdate = DateTime.Now;
            if (!DateTime.TryParse(TBXBirthDate.Text.Trim(), out birthdate))
            {
                spanErr.InnerText = "出生日期输入错误";
                //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('出生日期输入错误');</script>");
                return;
            }

            if (Session["VNum"] == null || String.Compare(Session["VNum"].ToString(), TBXValidateCode.Text.Trim(), true)!=0)
            {
                spanErr.InnerText = "验证码输入错误";
                //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('验证码输入错误');</script>");
                return;
            }
            CY.CSTS.Core.Business.User usertemp = CY.CSTS.Core.Business.User.GetUserByUserId(TBXUserID.Text.Trim());
            if (usertemp != null)
            {
                spanErr.InnerText = "该用户名已存在";
                //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('该用户名已存在')</script>");
                return;
            }
            #endregion

            CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User();

            user.UserID = TBXUserID.Text.Trim();
            user.Password = TBXUserPsw.Text.Trim();
            user.Name = TBXRealName.Text.Trim();
            user.BirthDate = birthdate;
            user.Gender = RBtnGender1.Checked ? "男" : "女";
            user.Email = TBXEmail.Text.Trim();
            user.RegDate = DateTime.Now;
            user.Status = 2;
            user.UserType = 1;

            try
            {
                user.Save();
                Session["User"] = user;
                oluMonitor.MemberAppend(user.UserID);
                FormsAuthentication.SetAuthCookie(user.UserID, false);

                string url = "UserCenter/UserInfo/UserInfo.aspx";
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('已注册成功,您可以继续完善个人资料');window.location.href='" + url + "';</script>");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] == null)
            {
                Response.Redirect("~/UserCenter/ToLogin.aspx");
            }
            user = Session["User"] as CY.CSTS.Core.Business.User;
            if (!IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.QueryString["ID"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["ID"]))
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                    return;
                }
                else
                {
                    CY.CSTS.Core.Business.view_INSTRUMENT instrument = CY.CSTS.Core.Business.view_INSTRUMENT.Load(InstrumentID);

                    if (instrument != null)
                    {
                        lbInstrumentName.Text = instrument.HNAME;
                        lbCommissionedPerson.Text = user.Name;
                    }

                    BindProjectType();
                }
            }
        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] == null)
     {
         Response.Redirect("../TempLogin.aspx");
     }
     user = Session["User"] as CY.CSTS.Core.Business.User;
     if (!IsPostBack)
     {
         if (string.IsNullOrEmpty(Context.Request.QueryString["Id"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["Id"]))
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
             return;
         }
         else
         {
             bindCtr(jrId);
             bindtable();
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] != null)
     {
         U = (CY.CSTS.Core.Business.User)Session["User"];
     }
     if (!IsPostBack)
     {
         lbManuId.Text = Context.Request.QueryString["ManuId"];
         BindDetail();
     }
 }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                U = (CY.CSTS.Core.Business.User)Session["User"];
            }
            else
            {
                Response.Redirect("../TempLogin.aspx");
            }
            CY.CSTS.Core.Business.User user = CY.CSTS.Core.Business.User.Load(U.Id);
            if (user != null)
            {
                if (user.UserType != 4)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('您没有权限评分!');</script>");
                    btnDone.Visible = false;
                    return;
                }
            }

            if (string.IsNullOrEmpty(Context.Request.QueryString["id"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["id"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                btnDone.Visible = false;
                return;
            }
            else
            {
                CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit unitAPP = CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit.Load(id);
                if (unitAPP == null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                    btnDone.Visible = false;
                    return;
                }
                else if (unitAPP.State != 9)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('没有可评审的申请!');</script>");
                    btnDone.Visible = false;
                    return;
                }
                if (Context.Request.QueryString["tab"] != null)
                {
                    hdTab.Value = Context.Request.QueryString["tab"];
                }
                if (!IsPostBack)
                {
                    bindtable();
                }

                attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(id);
            }
        }
Example #16
0
        protected void import_MachineMemeber_Click(object sender, EventArgs e)
        {
            List<CY.CSTS.Core.Business.INSTRUMENT> listInstrument =  CY.CSTS.Core.Business.INSTRUMENT.GetAllINSTRUMENT()
                as List<CY.CSTS.Core.Business.INSTRUMENT>;

            CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility();

            RelationSqlServerUtility rsql = new RelationSqlServerUtility();

            string Rsql = "select * from RSet";

            DataSet dsRSet = rsql.ExecuteSqlDataSet(Rsql);

            if (dsRSet != null && dsRSet.Tables.Count > 0 && dsRSet.Tables[0].Rows.Count > 0 && dsRSet.Tables[0].Columns.Count > 0)
            {
                for (int i = 0; i < dsRSet.Tables[0].Rows.Count; i++)
                {
                    string strsql = "select * from MACHINESET where SETID = " + dsRSet.Tables[0].Rows[i][0].ToString();

                    DataSet dsSet = isql.ExecuteSqlDataSet(strsql);

                    string[] strSetManID;
                    string strSetMan = "";
                    if (dsSet != null && dsSet.Tables.Count > 0 && dsSet.Tables[0].Rows.Count > 0 && dsSet.Tables[0].Columns.Count > 0)
                    {
                        strSetMan = dsSet.Tables[0].Rows[0]["SETMAN"].ToString();
                    }
                    if (strSetMan == "")
                    {
                        strSetMan = "0";
                    }
                    if (strSetMan != "0")
                    {
                        strSetManID = strSetMan.Split(',');

                        for (int j = 0; j < strSetManID.Count(); j++)
                        {
                            string strManID = strSetManID[j];
                            int iTemp = 0;
                            if (strManID != "" && int.TryParse(strManID, out iTemp))
                            {
                                //try
                                {
                                    if (CY.Utility.Common.StringHelper.IsGuid(dsRSet.Tables[0].Rows[i][1].ToString()))
                                    {
                                        Guid NewSetID = new Guid(dsRSet.Tables[0].Rows[i][1].ToString());
                                        CY.CSTS.Core.Business.MACHINESET newM = CY.CSTS.Core.Business.MACHINESET.Load(NewSetID);

                                        int usertype = 0;
                                        Guid UintID = new Guid();
                                        if (newM.Unit != null)
                                        {
                                            if (newM.Unit.IsCooperantUnit == 2)
                                            {
                                                usertype = 2;
                                            }
                                            else
                                            {
                                                usertype = 3;
                                            }
                                            UintID = newM.Unit.Id;

                                            strsql = "select * from PERSONNEL where PERSONNELID = " + strManID;

                                           DataSet ds = isql.ExecuteSqlDataSet(strsql);

                                            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0)
                                            {
                                                for (int k = 0; k < ds.Tables[0].Rows.Count; k++)
                                                {
                                                    if (ds.Tables[0].Rows[k][4] != null)
                                                    {
                                                        CY.CSTS.Core.Business.User user = CY.CSTS.Core.Business.User.GetUserByUserId(ds.Tables[0].Rows[k][4].ToString());
                                                        if (user == null)
                                                        {
                                                            user = new CY.CSTS.Core.Business.User();

                                                            user.UnitID = UintID;

                                                            user.UserType = usertype;

                                                            user.Password = "******";

                                                            user.UserID = ds.Tables[0].Rows[k][4].ToString();

                                                            user.Name = ds.Tables[0].Rows[k][4].ToString();

                                                            user.Gender = ds.Tables[0].Rows[k][5].ToString();

                                                            user.BirthDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[k][6].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[k][6].ToString()) : DateTime.MinValue;

                                                            user.EducationID = CY.CSTS.Import.Core.Business.User.TransferEducationId(ds.Tables[0].Rows[k][7].ToString());

                                                            user.PostRankID = CY.CSTS.Import.Core.Business.User.TransferTitltId(ds.Tables[0].Rows[k][8].ToString());

                                                            user.Specialty = ds.Tables[0].Rows[k][9].ToString();

                                                            user.Address = ds.Tables[0].Rows[k][10].ToString();

                                                            user.Mailcode = ds.Tables[0].Rows[k][11].ToString();

                                                            user.Phone = ds.Tables[0].Rows[k][12].ToString();

                                                            user.Fax = ds.Tables[0].Rows[k][13].ToString();

                                                            user.Email = ds.Tables[0].Rows[k][14].ToString();

                                                            user.Resume = ds.Tables[0].Rows[k][15].ToString();

                                                            user.Discourse = ds.Tables[0].Rows[k][20].ToString();

                                                            user.Acquire = ds.Tables[0].Rows[k][21].ToString();

                                                            user.Status = 2;

                                                            user.Remark = ds.Tables[0].Rows[k][25].ToString();

                                                            user.Save();
                                                        }

                                                        List<CY.CSTS.Core.Business.INSTRUMENT> tempListI =
                                                            listInstrument.Where(Items => Items.MachineGroupId == newM.Id).ToList();

                                                        if (tempListI.Count > 0)
                                                        {
                                                            CY.CSTS.Core.Business.MachineGroupMember MMember = new CY.CSTS.Core.Business.MachineGroupMember();
                                                            MMember.InstruID = tempListI[0].Id;
                                                            MMember.UserID = user.Id;
                                                            MMember.MachineGroupID = newM.Id;
                                                            MMember.Save();
                                                        }
                                                    }

                                                }
                                            }
                                        }
                                    }
                                }
                                //catch (Exception ex)
                                //{
                                //    throw ex;
                                //}
                            }
                        }

                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                U = (CY.CSTS.Core.Business.User)Session["User"];
            }
            else
            {
                Response.Redirect("../TempLogin.aspx");
            }
            if (string.IsNullOrEmpty(Context.Request.QueryString["id"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["id"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }
            else
            {
                id = new Guid(Context.Request.QueryString["id"]);
                string sqlwhere = "[JointReviewID]='" + id + "' and [ExpertID]='" + U.Id + "' and [ExpertHead]=1 ";
                IList<CY.CSTS.Core.Business.JointReviewExperts> jreList = CY.CSTS.Core.Business.JointReviewExperts.SelectJointReviewExpertsDynamic(sqlwhere, "");
                if (jreList == null || jreList.Count == 0)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('您没有权限总结!');window.location.href='JointReviewExpert.aspx'</script>");
                }

                if (!IsPostBack)
                {
                    bindgvSelList();
                }
            }
        }
Example #18
0
        public static void ImportUser(string oldID)
        {
            try
            {
                CY.Utility.DBUtility.ImportSqlServerUtility isql = new CY.Utility.DBUtility.ImportSqlServerUtility();

                string strsql = "select * from PERSONNEL where PERSONNELID = " + oldID;

                DataSet ds = isql.ExecuteSqlDataSet(strsql);

                RelationSqlServerUtility rsql = new RelationSqlServerUtility();

                string insertsql = "insert into RUser(old,new) values('{0}','{1}')";

                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        CY.CSTS.Core.Business.User user = new CY.CSTS.Core.Business.User();

                        user.UnitID = CY.CSTS.Import.Core.Business.UnitInfo.TransferUnitId(ds.Tables[0].Rows[i][0].ToString());

                        user.UserID = ds.Tables[0].Rows[i][4].ToString();

                        user.Name = ds.Tables[0].Rows[i][4].ToString();

                        user.Gender = ds.Tables[0].Rows[i][5].ToString();

                        user.BirthDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][6].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][6].ToString()) : DateTime.MinValue;

                        user.EducationID = TransferEducationId(ds.Tables[0].Rows[i][7].ToString());

                        user.PostRankID = TransferTitltId(ds.Tables[0].Rows[i][8].ToString());

                        user.Specialty = ds.Tables[0].Rows[i][9].ToString();

                        user.Address = ds.Tables[0].Rows[i][10].ToString();

                        user.Mailcode = ds.Tables[0].Rows[i][11].ToString();

                        user.Phone = ds.Tables[0].Rows[i][12].ToString();

                        user.Fax = ds.Tables[0].Rows[i][13].ToString();

                        user.Email = ds.Tables[0].Rows[i][14].ToString();

                        user.Resume = ds.Tables[0].Rows[i][15].ToString();

                        user.Discourse = ds.Tables[0].Rows[i][20].ToString();

                        user.Acquire = ds.Tables[0].Rows[i][21].ToString();

                        user.Status = 2;

                        user.Remark = ds.Tables[0].Rows[i][25].ToString();

                        user.Save();

                        rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), user.Id));

                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                U = (CY.CSTS.Core.Business.User)Session["User"];
            }
            else
            {
                Response.Redirect("../TempLogin.aspx");
            }
            CY.CSTS.Core.Business.User user = CY.CSTS.Core.Business.User.Load(U.Id);
            if (user != null)
            {
                if (user.UserType != 4)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('您没有权限评分!');</script>");
                    btnScore.Visible = false;
                    btnScore1.Visible = false;
                    return;
                }
            }

            if (string.IsNullOrEmpty(Context.Request.QueryString["id"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["id"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                btnScore.Visible = false; btnScore1.Visible = false;
                return;
            }
            else
            {
                jrId = new Guid(Context.Request.QueryString["id"]);
                if (!IsPostBack)
                {
                    if (CY.CSTS.Core.Business.JointReview.Load(jrId).Status != 12)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('没有可评审的申请!');</script>");
                        btnScore.Visible = false; btnScore1.Visible = false;
                        return;
                    }
                    bindtable();
                }
            }
        }
Example #20
0
        protected void btRegister_Click(object sender, EventArgs e)
        {
            CY.CSTS.Core.Business.User registerUser = new CY.CSTS.Core.Business.User();
            // 用户名
            if (tbUserName.Text != null && tbUserName.Text.Trim() != "")
            {
                if (CY.CSTS.Core.Business.User.GetUserByUserId(tbUserName.Text) != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('该ID已被其它用户注册,请更换ID')</script>");
                    return;
                }
                else
                {
                    registerUser.UserID = tbUserName.Text;
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请填写登陆ID')</script>");
                return;
            }

            // 电子邮件
            if (tbEmail.Text != null && tbEmail.Text.Trim() != "")
            {
                string email = tbEmail.Text.Trim();
                if (Regex.IsMatch(email, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"))
                {
                    //IList<CY.CSTS.Core.Business.User> all = CY.CSTS.Core.Business.User.GetAllUser() as List<CY.CSTS.Core.Business.User>;
                    //List<CY.CSTS.Core.Business.User> users = all.Where(item => item.Email == tbEmail.Text).ToList();
                    //if (users.Count == 0 || users == null)
                    //{
                        registerUser.Email = tbEmail.Text;
                    //}
                    //else5
                    //{
                    //    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件错误", "<script>alert('该电子邮件地址已被注册')</script>");
                    //    return;
                    //}
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件", "<script>alert('电子邮件格式不正确')</script>");
                    return;
                }

            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电子邮件", "<script>alert('请填写电子邮件')</script>");
                return;
            }

            // 性别
            if (rblSex.SelectedValue != "" && rblSex.SelectedValue != null)
            {
                registerUser.Gender = rblSex.SelectedValue;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择性别')</script>");
                return;
            }

            // 真实姓名
            if (tbRealName.Text != null && tbRealName.Text.Trim() != "")
            {
                registerUser.Name = tbRealName.Text;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请填写真实姓名')</script>");
                return;
            }
            if (ddlPostRand.Visible)
            {
                // 职称
                if (ddlPostRand.Text.Trim() != "")
                {
                    List<CY.CSTS.Core.Business.UserPostRank> postRankList = CY.CSTS.Core.Business.UserPostRank.GetAllUserPostRank()
                        as List<CY.CSTS.Core.Business.UserPostRank>;
                    postRankList = postRankList.Where(Items => Items.PostRankName == ddlPostRand.Text.Trim()).ToList();
                    Guid postId = new Guid();
                    if (postRankList.Count == 0)
                    {
                        CY.CSTS.Core.Business.UserPostRank post = new CY.CSTS.Core.Business.UserPostRank();
                        post.PostRankName = ddlPostRand.Text.Trim();
                        post.Save();
                        postId = post.Id;
                    }
                    else
                    {
                        postId = postRankList[0].Id;
                    }

                    registerUser.PostRankID = postId;
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择职称')</script>");
                    return;
                }
            }
            if (ddlEdu.Visible)
            {
                // 学历
                if (ddlEdu.SelectedValue != null && ddlEdu.SelectedValue != "")
                {
                    registerUser.EducationID = new System.Guid(ddlEdu.SelectedValue);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请选择学历')</script>");
                    return;
                }
            }

            // 头像
            if (hfIconPath.Value != null && !hfIconPath.Value.Equals(""))
            {
                registerUser.PicURL = hfIconPath.Value;
            }
            else
            {
                registerUser.PicURL = "Content/Icon/defaultIcon.jpg";
            }

            // 密码
            if (tbPwd.Text != null && tbPwd.Text != "" && tbPwdConfirm.Text != null && tbPwdConfirm.Text != "")
            {
                if (tbPwd.Text != tbPwdConfirm.Text)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('两次密码不一致')</script>");
                    return;
                }
                else
                {
                    registerUser.Password = tbPwd.Text;
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('请确认密码填写正确')</script>");
                return;
            }

            // 出生日期
            if (tbBirthday.Text.Trim() != "" && tbBirthday.Text != null)
            {
                registerUser.BirthDate = Convert.ToDateTime(tbBirthday.Text);
            }
            else
            {
                registerUser.BirthDate = new DateTime();
            }
            // 通信地址
            registerUser.Address = tbAddress.Text.Trim();
            // 邮政编码
            if (tbCode.Text != null && !tbCode.Text.Trim().Equals(""))
            {
                int temp = 0;
                string code = tbCode.Text.Trim();
                if (!int.TryParse(code, out temp))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "邮政编码错误", "<script>alert('邮政编码格式不对')</script>");
                    return;
                }
                else
                {
                    registerUser.Mailcode = code;
                }
            }
            else
            {
                registerUser.Mailcode = "";
            }

            // 传真
            registerUser.Fax = tbFax.Text;
            // 固定电话
            if (tbFixPhone.Text != null && !tbFixPhone.Text.Trim().Equals(""))
            {
                int tempPhone = 0;
                string phone = tbFixPhone.Text.Trim();
                if (!int.TryParse(phone, out tempPhone))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "电话错误", "<script>alert('电话格式不对')</script>");
                    return;
                }
                else
                {
                    registerUser.Phone = phone;
                }
            }
            else
            {
                registerUser.Phone = "";
            }

            // 移动电话
            registerUser.MobilePhone = tbCellFhone.Text;

            // 专长
            registerUser.Specialty = tbSpecialty.Text;
            // 专业简历
            registerUser.Resume = fckResume.Value;
            // 备注
            registerUser.Remark = tbRemark.Text;

            // 人员类型
            registerUser.UserType = Int32.Parse(ddlUserType.SelectedValue);
            if (registerUser.UserType != 1 && registerUser.UserType != 4 && registerUser.UserType != 5)
            {
                // 单位
                if (ddlUnit.SelectedValue != null && ddlUnit.SelectedValue != "")
                {
                    registerUser.UnitID = new System.Guid(ddlUnit.SelectedValue);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "单位", "<script>alert('请选择单位')</script>");
                    return;
                }
            }

            // 主要论文
            registerUser.Discourse = tbPaper.Value;
            // 获奖情况
            registerUser.Acquire = tbAcquire.Value;

            List<CY.CSTS.Core.Business.ExpertField> selectFiled = new List<CY.CSTS.Core.Business.ExpertField>();    // 保存研究领域
            if (ddlUserType.SelectedValue == "4")
            {
                // 所在单位
                registerUser.Unit = tbUnitOfExpert.Text;
                // 职务
                registerUser.Duty = tbDuty.Text;
                // 研究领域1
                if (ddlField.SelectedValue != null && ddlField.SelectedValue != "")
                {
                    registerUser.FeildID = new System.Guid(ddlField.SelectedValue);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "研究领域", "<script>alert('请选择研究领域')</script>");
                    return;
                }
                // 研究领域2
                for (int i = 0; i < cblField.Items.Count; i++)
                {
                    if (cblField.Items[i].Selected)
                    {
                        CY.CSTS.Core.Business.ExpertField f = new CY.CSTS.Core.Business.ExpertField();
                        f.FieldID = new Guid(cblField.Items[i].Value);
                        selectFiled.Add(f);
                    }
                }
            }

            // 注册时间
            registerUser.RegDate = System.DateTime.Now;
            // 最后登录时间
            //registerUser.LastActiveTime = new DateTime();
            // 状态, 2 表示正常
            registerUser.Status = 2;

            // 保存用户
            //registerUser.Save();

            // 保存专家研究领域
            if (ddlUserType.SelectedValue == "4")
            {
                // SaveAndGetId保存专家用户,并获取ID
                string id = registerUser.SaveAndGetId();
                for (int j = 0; j < selectFiled.Count; j++)
                {
                    selectFiled[j].ExpertID = new Guid(id);
                    selectFiled[j].Save();
                }
            }
            else
            {
                registerUser.Save();
            }

            //Server.Transfer("UserInfo.aspx");

            // 跳回上一页面
            if (ViewState["PrePage"] != null)
            {
                string url = ViewState["PrePage"].ToString();
                Response.Redirect(url);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "添加成功", "<script>alert('添加成功')</script>");
                return;
            }
        }
        /// <summary>
        /// 右边随机专家绑定
        /// </summary>
        private void RandomExpert_DateBind(Guid fieldId)
        {
            List<CY.CSTS.Core.Business.User> uList =
                            CY.CSTS.Core.Business.User.SelectUsersDynamic(" UserType=4 ", "")
                            as List<CY.CSTS.Core.Business.User>;
            uList = uList.Where(Items => (Items.Field.Where(fItems => fItems.Id == fieldId)).ToList().Count > 0).ToList();

            int eCount = uList.Count;
            int realNum = 6;//显示的专家数目

            if (eCount <= realNum)
            {
                randomUserList = uList;
            }
            else
            {
                Random r = new Random();

                for (int i = 0; i < realNum; i++)
                {
                    int iRandom = r.Next(0, eCount);
                    CY.CSTS.Core.Business.User f = new CY.CSTS.Core.Business.User();

                    f = uList[iRandom];
                    randomUserList.Add(f);

                    uList.RemoveAt(iRandom);
                    eCount = uList.Count;
                }
            }
        }