コード例 #1
0
        public ExecutionResult SaveGraphicPushData(List <PushParamModel> textPush)
        {
            ExecutionResult result  = new ExecutionResult();
            U_PushMsg       pushMsg = new U_PushMsg();

            pushMsg.VGUID            = Guid.NewGuid();
            pushMsg.PushType         = 1;
            pushMsg.MessageType      = 3;
            pushMsg.Title            = textPush[0].Title;
            pushMsg.Message          = textPush[0].Message;
            pushMsg.PushPeople       = textPush[0].founder;
            pushMsg.PeriodOfValidity = DateTime.Now.AddMonths(1);
            pushMsg.CreatedUser      = "******";
            pushMsg.CreatedDate      = DateTime.Now;
            UserInfoLogic userInfoLogic = new UserInfoLogic();

            foreach (string item in textPush[0].PushPeople)
            {
                var user = userInfoLogic.GetPerson(item);
                if (user != null && user.UserID != null && user.UserID != "")
                {
                    textPush[0].PushPeoples += user.UserID + "|";
                    pushMsg.PushObject      += user.UserID + "|";
                }
                else
                {
                    result.Message += item + "|";
                }
            }
            if (!string.IsNullOrEmpty(result.Message))
            {
                result.Message = result.Message.Remove(result.Message.Length - 1, 1);
                result.Message = "不存在身份证号码:" + result.Message;
                return(result);
            }
            textPush[0].PushPeoples = textPush[0].PushPeoples.TrimEnd('|');

            List <Business_WeChatPush_MoreGraphic_Information> pushMoreGraphicList = new List <Business_WeChatPush_MoreGraphic_Information>();

            foreach (PushParamModel push in textPush)
            {
                Business_WeChatPush_MoreGraphic_Information pushMoreGraphic = new Business_WeChatPush_MoreGraphic_Information();
                pushMoreGraphic.Title           = push.Title;
                pushMoreGraphic.CoverImg        = pushMoreGraphic.Message = push.Message;
                pushMoreGraphic.CoverImg        = push.Image;
                pushMoreGraphic.CreatedDate     = DateTime.Now;
                pushMoreGraphic.CreatedUser     = "******";
                pushMoreGraphic.WeChatPushVguid = pushMsg.VGUID;
                pushMoreGraphic.VGUID           = Guid.NewGuid();
                pushMoreGraphicList.Add(pushMoreGraphic);
            }


            DraftInfoLogic logic = new DraftInfoLogic();
            Guid           vguid = Guid.Empty;

            result.Success = logic.APISaveImagePushMsg(pushMsg, pushMoreGraphicList);
            result.Result  = new { Uniquekey = pushMsg.VGUID };
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 根据手机号码获取身份证号码
        /// </summary>
        /// <param name="SECURITYKEY">加密值</param>
        /// <param name="phoneNumber">手机号码</param>
        /// <returns></returns>
        public JsonResult UserIDNumber(string SECURITYKEY, string phoneNumber)
        {
            ExecutionResult result = new ExecutionResult();

            try
            {
                if (API_Authentication(SECURITYKEY))
                {
                    result.Result = "";
                    UserInfoLogic logic = new UserInfoLogic();
                    var           user  = logic.GetPersonByPhoneNumber(phoneNumber);
                    if (user != null)
                    {
                        result.Result = user.IDNumber;
                    }
                    result.Success = true;
                }
                else
                {
                    result.Message = "SECURITYKEY 无效!";
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                LogHelper.WriteLog(ex.Message);
            }
            ExecHistry("UserIDNumber", phoneNumber, JsonHelper.ModelToJson(result));
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        protected void Change_Submit(object sender, EventArgs e)
        {
            string nphone = newphone.Text;
            string nemail = newemail.Text;

            Debug.WriteLine("beforupdatephone=" + nphone);
            Debug.WriteLine("befupdateemail=" + nemail);
            DateTime?nbirth = null;

            CalculateOnlineJudge.Entity.UserInfo nuserinfo = new CalculateOnlineJudge.Entity.UserInfo(nbirth, nphone, nemail);
            updateresult = UserInfoLogic.UpdateUserInfo(nuserinfo, user);
            if (!updateresult.IsSuccess)
            {
                newphone.Text = Session["LastPhone"].ToString();
                newemail.Text = Session["LastEmail"].ToString();
            }
            else
            {
                Session["LastPhone"] = newphone.Text;
                Session["LastEmail"] = newemail.Text;
            }
            Debug.WriteLine("aftupdatephone=" + nphone);
            Debug.WriteLine("aftupdateemail=" + nemail);
            MessaegBox(updateresult.Prompt);
        }
コード例 #4
0
    protected void btnEnter_Click(object sender, EventArgs e)
    {
        if (username.Text == "admin" && password.Text == "admin")
        {
            Session["loggedin"] = true;
            Session["IsAdmin"]  = true;
            Response.Redirect("Default.aspx");
        }
        else
        {
            string        j           = username.Text;
            string        k           = password.Text;
            UserInfoLogic objUserInfo = new UserInfoLogic();
            UserInfoItem  n           = objUserInfo.GetUserInfoByEmailAndNCode(j, k);

            //if (n.IsFill == true)
            if (string.IsNullOrEmpty(n.FirstName) == false)
            {
                Session["loggedin"]   = true;
                Session["IsAdmin"]    = false;
                Session["nam"]        = n.FirstName;
                Session["lastnam"]    = n.LastName;
                Session["imagecode"]  = n.NCode;
                Session["pasvandpic"] = n.Extention;
                Response.Redirect("Default.aspx");
            }
            else
            {
                //نام کاربری یا کلمه عبور صحیح نیست
                //لطفا دوباره تلاش کنید
            }
            //    StreamReader sr = new StreamReader(Server.MapPath(ConfigurationManager.AppSettings["LOG_PATH"]));
            //    while (!sr.EndOfStream)
            //    {
            //        string i = sr.ReadLine();
            //        if (i.IndexOf(username.Text) >= 0 && i.IndexOf(password.Text)>=0)
            //        {
            //            Session["loggedin"] = true;
            //            Session["IsAdmin"] = false;
            //            string[] splitetext = i.Split(',');
            //            Session["nam"] = splitetext[0];
            //            Session["lastnam"] = splitetext[1];
            //            Session["imagecode"] = splitetext[3];
            //            Session["pasvandpic"] = splitetext[11];
            //            Response.Redirect("Default.aspx");


            //        }
            //        else
            //        {
            //            Session["loggedin"] = false;
            //            lbl_show.Text = "enter correct username and password";
            //        }
            //    }
            //    sr.Close();
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)

    {
        //if (Session["loggedin"] == null)
        //{
        //    Response.Redirect("pagelogin.aspx");
        //}
        //else
        //{

        string searchm = Request.QueryString["meli"];

        if (string.IsNullOrEmpty(searchm))
        {
            Response.Redirect("~/searchpage.aspx");
        }
        else
        {
            //StreamReader sr = new StreamReader(Server.MapPath(ConfigurationManager.AppSettings["LOG_PATH"]));
            //while (!sr.EndOfStream)
            //{
            //    string i = sr.ReadLine();
            //    if (i.IndexOf(searchm) >= 0)
            //    {
            //        string[] splitetext = i.Split(',');
            //        txt_name2.Text = splitetext[0];
            //        txt_lastname2.Text = splitetext[1];
            //        txt_codemeli2.Text = splitetext[2];
            //        txt_father.Text = splitetext[3];
            //        tex_mail2.Text = splitetext[4];
            //        txt_reshte2.Text = splitetext[5];
            //        txt_madrak2.Text = splitetext[6];
            //        imageperson.ImageUrl = ConfigurationManager.AppSettings["PHOTO_UPLOAD_PATH"] + searchm + ".jpg";
            //    }
            //}
            //sr.Close();
            //بجای استفاده از کد های بالا ،حالا می خواهیم از کلاس استفاده نماییم
            UserInfoLogic objUserInfo = new UserInfoLogic();

            UserInfoItem z = objUserInfo.GetUserInfoByNCode(searchm);
            if (z.IsFill == true)
            {
                txt_name2.Text       = z.FirstName;
                txt_lastname2.Text   = z.LastName;
                txt_codemeli2.Text   = z.NCode;
                txt_father.Text      = z.FatherName;
                tex_mail2.Text       = z.Email;
                txt_reshte2.Text     = z.Major;
                txt_madrak2.Text     = z.Education;
                imageperson.ImageUrl = ConfigurationManager.AppSettings["PHOTO_UPLOAD_PATH"] + z.NCode + z.Extention;
            }
        }

        //}
    }
コード例 #6
0
        public static void Main(string[] args)
        {
            Console.WriteLine("输入创建用户名,例如:FREEstrikerABbo");
            //string userName = Console.ReadLine();
            string userName = "******";

            Console.WriteLine("输入创建密码,例如:1236zccg99326TEST");
            //string password = Console.ReadLine();
            string password = "******";

            Console.WriteLine(UserLogic.CreateUser(userName, password).Prompt);
            var userOR = UserLogic.LogInUser(userName, password);

            Console.WriteLine(userOR.Prompt);
            var userInfoOR = UserInfoLogic.GetUserInfo(userOR.Result);

            Console.WriteLine(userInfoOR.Prompt);
            var judgeInfoOR = JudgeInfoLogic.GetJudgeInfo(userOR.Result);

            Console.WriteLine(judgeInfoOR.Prompt);
            ExerciseOption exerciseOption = new ExerciseOption(IntervalType.LE10,
                                                               //OperationType.Plus |
                                                               //OperationType.Sub |
                                                               //OperationType.Mul |
                                                               //OperationType.Div |
                                                               OperationType.DivWithRemainder, QuantityType.E10);
            var exerciseOR = ExerciseLogic.GetExercise(exerciseOption);

            Console.WriteLine(exerciseOR.Prompt);
            for (int i = 0; i < exerciseOR.Result.ExerciseUnits.Length; i++)
            {
                Console.WriteLine(exerciseOR.Result.ExerciseUnits[i].Topic);
            }
            Console.WriteLine("输入答案:");
            ExerciseResult exerciseResult = new ExerciseResult()
            {
                ExerciseResultUnit = new ExerciseResultUnit[exerciseOR.Result.ExerciseUnits.Length]
            };

            for (int i = 0; i < exerciseOR.Result.ExerciseUnits.Length; i++)
            {
                exerciseResult.ExerciseResultUnit[i].Remainder = 0;
                exerciseResult.ExerciseResultUnit[i].Result    = Convert.ToInt32(Console.ReadLine());
            }
            var judgeResultOR = ExerciseLogic.JudgeExercise(exerciseOR.Result, exerciseResult, userOR.Result);

            Console.WriteLine(judgeResultOR.Prompt);
            userInfoOR = UserInfoLogic.GetUserInfo(userOR.Result);
            Console.WriteLine(userInfoOR.Prompt);
            judgeInfoOR = JudgeInfoLogic.GetJudgeInfo(userOR.Result);
            Console.WriteLine(judgeInfoOR.Prompt);
            Console.WriteLine(UserLogic.DeleteUser(userOR.Result).Prompt);
            Console.ReadKey();
        }
コード例 #7
0
    protected void gvPerson2_SelectedIndexChanged(object sender, EventArgs e)
    {
        string              x         = gvPerson2.SelectedValue.ToString();
        UserInfoLogic       usersList = new UserInfoLogic();
        List <UserInfoItem> AllUsers  = new List <UserInfoItem>();
        UserInfoItem        y         = usersList.GetUserInfoByNCode(x);

        AllUsers.Add(y);
        FV2.DataSource = AllUsers;
        FV2.DataBind();
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserInfoLogic       usersList = new UserInfoLogic();
        List <UserInfoItem> AllUsers  = new List <UserInfoItem>();

        AllUsers       = usersList.GetAllData();
        LV1.DataSource = AllUsers;
        LV1.DataBind();
        LV2.DataSource = AllUsers;
        LV2.DataBind();
        DV1.DataSource = AllUsers;
        DV1.DataBind();
    }
コード例 #9
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         UserInfoLogic       usersList2 = new UserInfoLogic();
         List <UserInfoItem> AllUsers2  = new List <UserInfoItem>();
         AllUsers2             = usersList2.FilterByNameLastnameEmail(txt_name.Text, txt_lastname.Text, TextBox1.Text);
         LVArgument.DataSource = AllUsers2;
         LVArgument.DataBind();
     }
     catch
     {
         lblshow.Text = "یافت نشد";
     }
 }
コード例 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblTedadonline.Text = Application["TotalOnlineUsers"].ToString();
        //lbl_entertime.Text = Session["entertime"].ToString();
        lblNowtime.Text = DateTime.Now.ToString();
        //زمان ورود باید ثابت بماند
        // در صورت چک نکردن خالی بودن یا نبودن هی دیت تایم دات نا را میریزه تو سشن و نمایش می دهد بنابراین ثابت نمی ماند
        if (Session["startTime"] == null)
        {
            Session["startTime"] = DateTime.Now;
        }
        else
        {
            DateTime a = (DateTime)Session["startTime"];
            DateTime b = DateTime.Now;
            TimeSpan c = b.Subtract(a);
            lblPasstime.Text = c.ToString();



            if (c > TimeSpan.Parse(ConfigurationManager.AppSettings["time"]))
            {
                lblVaziat.Text = "your time is expired";
            }
        }

        lblVorodtime.Text = Session["startTime"].ToString();
        UserInfoLogic d = new UserInfoLogic();
        int           x = d.NumberOfRejisterd();

        lblSabtenamiha.Text = x.ToString();


        //StreamReader sabtenamiha = new StreamReader(Server.MapPath(ConfigurationManager.AppSettings["LOG_PATH"]));
        //int k = 0;
        //while (sabtenamiha.Peek() > 0)
        //{

        //    sabtenamiha.ReadLine();
        //    k++;

        //}
        //lblSabtenamiha.Text= k.ToString();
    }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string s = ddlEducation.SelectedValue;

        if (string.IsNullOrEmpty(s))
        {
            UserInfoLogic       usersList = new UserInfoLogic();
            List <UserInfoItem> AllUsers  = new List <UserInfoItem>();
            AllUsers = usersList.GetAllData();
            LVArgument.DataSource = AllUsers;
            LVArgument.DataBind();
        }
        else
        {
            UserInfoLogic       y = new UserInfoLogic();
            List <UserInfoItem> x = new List <UserInfoItem>();
            x = y.FilterByEducation(ddlEducation.SelectedValue);
            LVArgument.DataSource = x;
            LVArgument.DataBind();
        }
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session["loggedin"] == null)
        //{
        //    Response.Redirect("pagelogin.aspx");
        //}
        //else
        //{
        if (!Page.IsPostBack)
        {
            UserInfoLogic       usersList = new UserInfoLogic();
            List <UserInfoItem> AllUsers  = new List <UserInfoItem>();
            AllUsers             = usersList.GetAllData();
            gvPerson2.DataSource = AllUsers;
            gvPerson2.DataBind();
        }



        //}
    }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = Request.QueryString["username"];
            string id       = Request.QueryString["id"];

            Debug.WriteLine(username);
            Debug.WriteLine(id);
            user       = new CalculateOnlineJudge.Entity.User(Convert.ToInt32(id), username);
            userinfoOR = UserInfoLogic.GetUserInfo(user);
            Debug.WriteLine(userinfoOR.Prompt);
            if (!IsPostBack)
            {
                if (userinfoOR.Result.Phone != null)
                {
                    newphone.Text = userinfoOR.Result.Phone;
                }
                else
                {
                    newphone.Text = null;
                }
                if (userinfoOR.Result.Email != null)
                {
                    newemail.Text = userinfoOR.Result.Email;
                }
                else
                {
                    newemail.Text = null;
                }
                lastphone            = userinfoOR.Result.Phone;
                lastemail            = userinfoOR.Result.Email;
                Session["LastPhone"] = lastphone;
                Session["LastEmail"] = lastemail;
                Debug.WriteLine("加载页面");
                Debug.WriteLine("getphone=" + userinfoOR.Result.Phone);
                Debug.WriteLine("getemail=" + userinfoOR.Result.Email);
            }
        }
コード例 #14
0
        public JsonResult TextPush(string SECURITYKEY, string pushparam)
        {
            ExecutionResult result = new ExecutionResult();

            try
            {
                if (API_Authentication(SECURITYKEY))
                {
                    PushParamModel textPush = Extend.JsonToModel <PushParamModel>(pushparam);
                    U_PushMsg      pushMsg  = new U_PushMsg();
                    pushMsg.VGUID            = Guid.NewGuid();
                    pushMsg.PushType         = 1;
                    pushMsg.MessageType      = 1;
                    pushMsg.Title            = textPush.Title;
                    pushMsg.Message          = textPush.Message;
                    pushMsg.PushPeople       = textPush.founder;
                    pushMsg.CreatedUser      = "******";
                    pushMsg.CreatedDate      = DateTime.Now;
                    pushMsg.PeriodOfValidity = DateTime.Now.AddMonths(1);
                    UserInfoLogic userInfoLogic = new UserInfoLogic();
                    if (textPush.PushPeople.Count == 0)
                    {
                        result.Message = "推送人员不能为空!";
                        ExecHistry("TextPush", pushparam, JsonHelper.ModelToJson(result));
                        return(Json(result));
                    }
                    foreach (string item in textPush.PushPeople)
                    {
                        var user = userInfoLogic.GetPerson(item);
                        if (user != null && user.UserID != null && user.UserID != "")
                        {
                            pushMsg.PushPeople += user.UserID + "|";
                            pushMsg.PushObject += user.UserID + "|";
                        }
                        else
                        {
                            result.Message += item + "|";
                        }
                    }
                    if (!string.IsNullOrEmpty(result.Message))
                    {
                        result.Message = result.Message.Remove(result.Message.Length - 1, 1);
                        result.Message = "不存在身份证号码:" + result.Message;
                        ExecHistry("TextPush", pushparam, JsonHelper.ModelToJson(result));
                        return(Json(result));
                    }
                    DraftInfoLogic logic = new DraftInfoLogic();
                    Guid           vguid = Guid.Empty;
                    result.Success = logic.APISavePushMsg(pushMsg);
                    result.Result  = new { Uniquekey = pushMsg.VGUID };
                }
                else
                {
                    result.Message = "SECURITYKEY 无效!";
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                LogHelper.WriteLog(ex.Message);
            }
            ExecHistry("TextPush", pushparam, JsonHelper.ModelToJson(result));
            return(Json(result));
        }
コード例 #15
0
        public JsonResult WeChatRegistered(string SECURITYKEY, string pushparam)
        {
            ExecutionResult result = new ExecutionResult();

            try
            {
                if (API_Authentication(SECURITYKEY))
                {
                    //if (!APICount())
                    //{
                    //    result.Message = "删除微信官方通讯录次数已经用完!";
                    //}
                    //else
                    //{

                    string             accessToken = WeChatTools.GetAccessoken(true);
                    U_WeChatRegistered user        = Extend.JsonToModel <U_WeChatRegistered>(pushparam);

                    string pushResult   = WeChatTools.CreateUser(accessToken, user);
                    var    wechatResult = Extend.JsonToModel <U_WechatResult>(pushResult);
                    if (wechatResult.errcode == "0")
                    {
                        UserInfoLogic logic = new UserInfoLogic();
                        logic.InsertTrainers(user);
                        result.Success = true;
                    }
                    result.Message = pushResult;


                    //string accessToken = WeChatTools.GetAccessoken(true);
                    //U_WeChatRegistered user = Extend.JsonToModel<U_WeChatRegistered>(pushparam);
                    //var wResult = WeChatTools.GetUserInfoByUserID(accessToken, user.idcard);
                    //var wechatResult = Extend.JsonToModel<U_WechatResult>(wResult);
                    //if (wechatResult.errcode == "0")
                    //{
                    //    WeChatTools.DeleteUser(accessToken, user.idcard);
                    //}
                    //wResult = WeChatTools.GetUserId(accessToken, user.mobile);
                    //Dictionary<string, string> dicReuslt = Extend.JsonToModel<Dictionary<string, string>>(wResult);
                    //if (dicReuslt["errcode"] == "0")
                    //{
                    //    string userid = dicReuslt["userid"];
                    //    WeChatTools.DeleteUser(accessToken, userid);
                    //}

                    //string pushResult = WeChatTools.CreateUser(accessToken, user);
                    //wechatResult = Extend.JsonToModel<U_WechatResult>(pushResult);
                    //if (wechatResult.errcode == "0")
                    //{
                    //    UserInfoLogic logic = new UserInfoLogic();
                    //    logic.InsertTrainers(user);
                    //    result.Success = true;
                    //}
                    //result.Message = pushResult;
                    //}
                }
                else
                {
                    result.Message = "SECURITYKEY 无效!";
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                LogHelper.WriteLog(ex.Message);
            }
            ExecHistry("WeChatRegistered", pushparam, JsonHelper.ModelToJson(result));
            return(Json(result));
        }
コード例 #16
0
        public JsonResult WeChatMobileChange(string SECURITYKEY, string pushparam)
        {
            ExecutionResult result = new ExecutionResult();

            try
            {
                if (API_Authentication(SECURITYKEY))
                {
                    string             accessToken   = Common.WeChatPush.WeChatTools.GetAccessoken(true);
                    U_WeChatRegistered user          = Extend.JsonToModel <U_WeChatRegistered>(pushparam);
                    UserInfoLogic      userInfoLogic = new UserInfoLogic();
                    var muser = userInfoLogic.GetPerson(user.idcard);
                    if (muser != null)
                    {
                        userInfoLogic.UpdatePhoneNumber(muser.UserID, user.mobile);
                        //userInfoLogic.DeleteUserInfo(new string[] { muser.Vguid.ToString() });
                        string pushResult   = WeChatTools.DeleteUser(accessToken, muser.UserID);
                        var    wechatResult = Extend.JsonToModel <U_WechatResult>(pushResult);
                        if (wechatResult.errcode != "0")
                        {
                            result.Message = pushResult;
                        }
                        else
                        {
                            UserInfoLogic logic       = new UserInfoLogic();
                            var           allTrainers = logic.GetTrainers(user);
                            if (allTrainers != null)
                            {
                                user.userid = allTrainers.IDCard;
                                user.name   = allTrainers.Name;
                                user.gender = allTrainers.Gender.ToString();
                                //string pushResult = WeChatTools.WeChatMobileChange(accessToken, muser.UserID, user.mobile);

                                pushResult   = WeChatTools.CreateUser(accessToken, user);
                                wechatResult = Extend.JsonToModel <U_WechatResult>(pushResult);
                                if (wechatResult.errcode == "0")
                                {
                                    logic.UpdateTrainers(user);
                                    result.Success = true;
                                }
                                result.Message = pushResult;
                            }
                            else
                            {
                                result.Message = string.Format("该身份证号码:{0} 用户在培训注册表中不存在!", user.idcard);
                            }
                        }
                    }
                    else
                    {
                        result.Message = string.Format("该身份证号码:{0} 用户不存在", user.idcard);
                    }
                }
                else
                {
                    result.Message = "SECURITYKEY 无效!";
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                LogHelper.WriteLog(ex.Message);
            }
            ExecHistry("WeChatRegistered", pushparam, JsonHelper.ModelToJson(result));
            return(Json(result));
        }
コード例 #17
0
        /// <summary>
        /// 根据手机号,身份证号删除人员信息
        /// </summary>
        /// <param name="SECURITYKEY">加密值</param>
        /// <param name="phoneNumber">手机号码</param>
        /// /// <param name="IDNumber">身份证号</param>
        /// <returns></returns>
        public JsonResult DeleteUserInfo(string SECURITYKEY, string phoneNumber, string IDNumber)
        {
            ExecutionResult result = new ExecutionResult();

            try
            {
                if (API_Authentication(SECURITYKEY))
                {
                    string accessToken = WeChatTools.GetAccessoken(true);
                    result.Result = "";
                    //删除本地人员表中信息
                    UserInfoLogic userInfoLogic = new UserInfoLogic();
                    Business_Personnel_Information personInfo = userInfoLogic.GetPerson(IDNumber);
                    var userID = "";
                    if (personInfo != null)
                    {
                        userID = personInfo.UserID;
                        if (userID != "")
                        {
                            WeChatTools.DeleteUser(accessToken, userID);
                        }
                    }
                    //删除微信官方后台人员信息
                    string     GetUserInfoByUserID  = WeChatTools.GetUserInfoByUserID(accessToken, phoneNumber);
                    string     GetUserInfoByUserID2 = WeChatTools.GetUserInfoByUserID(accessToken, IDNumber);
                    U_UserInfo userDetail           = JsonHelper.JsonToModel <U_UserInfo>(GetUserInfoByUserID);  //用户信息phoneNumber
                    U_UserInfo userDetail2          = JsonHelper.JsonToModel <U_UserInfo>(GetUserInfoByUserID2); //用户信息IDNumber
                    string     respText1            = "";
                    string     respText2            = "";
                    string     respText3            = "";
                    string     userid = "";
                    if (userDetail.userid != null)
                    {
                        //手机号是userid
                        respText1 = WeChatTools.DeleteUser(accessToken, phoneNumber);
                    }
                    else
                    {
                        respText1 = "手机号是userid,未查找到人员数据";
                    }
                    if (userDetail2.userid != null)
                    {
                        //身份证是userid
                        respText2 = WeChatTools.DeleteUser(accessToken, IDNumber);
                    }
                    else
                    {
                        respText2 = "身份证是userid,未查找到人员数据";
                    }
                    //根据手机号查询userid
                    var     useridJ    = WeChatTools.GetUserId(accessToken, phoneNumber);
                    JObject useridJson = JObject.Parse(useridJ);
                    try
                    {
                        userid    = useridJson["userid"].ToString();
                        respText3 = WeChatTools.DeleteUser(accessToken, userid);
                    }
                    catch (Exception)
                    {
                        respText3 = "通过手机号,未查找到人员数据";
                    }
                    var isDelete = userInfoLogic.DeletePersonInfo(IDNumber);
                    result.Success = true;
                    result.Result  = respText1 + ";" + respText2 + ";" + respText3;
                    ExecHistry("根据身份证删除本地用户", IDNumber, isDelete.ToString());
                    ExecHistry("根据手机号删除微信用户,WeChatTools.DeleteUser", phoneNumber, respText1);
                    ExecHistry("根据身份证删除微信用户,WeChatTools.DeleteUser", IDNumber, respText2);
                    ExecHistry("根据手机号查询userid删除微信用户,WeChatTools.DeleteUser", userid, respText3);
                    ExecHistry("根据手机号查询userid,WeChatTools.GetUserId", phoneNumber, userid);
                }
                else
                {
                    result.Message = "SECURITYKEY 无效!";
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                LogHelper.WriteLog(ex.Message);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        string fileExtPhoto         = "";
        string fileExtAllowForPhoto = "";
        long   fileSizePhoto        = 0;
        int    fileSizeMaxForPhoto  = 0;
        int    indexFound           = 0;
        bool   uploadPhotoSuccess   = false;

        if (fuPhoto.FileName.Length != 0)
        {
            fileExtPhoto         = Path.GetExtension(fuPhoto.FileName);
            fileExtAllowForPhoto = ConfigurationManager.AppSettings["PHOTO_TYPE_ALLOW"];
            fileSizePhoto        = fuPhoto.FileContent.Length;
            fileSizeMaxForPhoto  = Convert.ToInt32(ConfigurationManager.AppSettings["PHOTO_MAX_LENGTH"]);
            indexFound           = fileExtAllowForPhoto.IndexOf(fileExtPhoto);

            if (indexFound >= 0)
            {
                if (fileSizePhoto <= fileSizeMaxForPhoto)
                {
                    try
                    {
                        //اجرای عملیات آپلود

                        fuPhoto.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["PHOTO_UPLOAD_PATH"]) + txt_codemeli.Text + fileExtPhoto);
                        uploadPhotoSuccess = true;
                    }
                    catch (Exception)
                    {
                        lblMessage.Text = "Sorry, There was a problem on saving photo to server!";
                    }
                }
                else
                {
                    lblMessage.Text = "Upload status: File not uploaded, Please choose corect size!";
                }
            }
            else
            {
                //نمایش پیغام به کاربر
                lblMessage.Text = "Upload status: File not uploaded, Please choose corect format!";
            }
        }
        else
        {
            lblMessage.Text = "Upload status: you should select photo to upload !";
        }

        if (uploadPhotoSuccess == true)
        {
            //StreamWriter sw = new StreamWriter(Server.MapPath(ConfigurationManager.AppSettings["LOG_PATH"]), true);
            //sw.WriteLine(txt_name.Text + "," + txt_lastname.Text + "," + txt_codemeli.Text + "," + txt_father.Text + "," + txt_address.Text + "," + txt_tell.Text + "," + txt_mail.Text + "," + year.Text + "/" + month.Text + "/" + day.Text + "," + reshte.SelectedValue + "," + madrak.SelectedValue + "," + fileExtPhoto);
            //sw.Close();
            //استفاده از مبحث کلاس ها
            UserInfoItem objUserInfo = new UserInfoItem();
            objUserInfo.FirstName  = txt_name.Text;
            objUserInfo.LastName   = txt_lastname.Text;
            objUserInfo.FatherName = txt_father.Text;
            objUserInfo.NCode      = txt_codemeli.Text;
            objUserInfo.Tell       = txt_tell.Text;
            objUserInfo.Email      = txt_mail.Text;
            objUserInfo.Major      = reshte.SelectedValue;
            objUserInfo.Education  = madrak.SelectedValue;
            objUserInfo.Gender     = rblGender.SelectedValue;
            objUserInfo.Birthday   = year.Text + "/" + month.Text + "/" + day.Text;
            objUserInfo.Address    = txt_address.Text;
            objUserInfo.Extention  = fileExtPhoto;
            UserInfoLogic l = new UserInfoLogic();
            l.Insert(objUserInfo);

            //در آخرین خط کد یعنی خط بالا ،متد اینزرت  را در کلاس یوزر اینفو صدا زدیم و چون فاقد ورودی است داخل پرانتزش خالی است.
        }

        StreamReader n = new StreamReader(Server.MapPath("~/emailpage.html"));
        string       m = "";

        while (n.Peek() > 0)
        {
            m = m + n.ReadLine();
        }

        m = m.Replace("{name}", txt_name.Text);
        m = m.Replace("{lastname}", txt_lastname.Text);
        m = m.Replace("{codemeli}", txt_codemeli.Text);
        string tvl = day.Text + "/" + month.Text + "/" + year.Text;

        m = m.Replace("{tavalod}", tvl);
        m = m.Replace("{email}", txt_mail.Text);
        m = m.Replace("{reshte}", reshte.Text);
        m = m.Replace("{madrak}", madrak.Text);

        MailMessage mail = new MailMessage();

        mail.To.Add(txt_mail.Text);
        //mail.To.Add(txtmail.Text);
        mail.From            = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["SENDER_ID"]);
        mail.Subject         = "اطلاعات فردی";
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body            = m;
        mail.BodyEncoding    = System.Text.Encoding.UTF8;
        mail.IsBodyHtml      = true;
        mail.Priority        = MailPriority.High;

        SmtpClient aryavandidadsmtpc = new SmtpClient();

        try
        {
            aryavandidadsmtpc.Send(mail);
            lblshow.Text = "Successfully Send...";
        }
        catch (Exception ex)
        {
            lblshow.Text = "Sending Failed...";
        }
    }