Exemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.ValidateRequiredFields(RequiredFields))
         {
             return;
         }
         if (ObjEUserInfo == null)
         {
             ObjEUserInfo = new EUserInfo();
         }
         ParseUserDetails();
         ObjBUserInfo        = new BUserInfo();
         ObjEUserInfo.UserID = ObjBUserInfo.SaveUserDetails(ObjEUserInfo);
         BindUserData();
         ClearData();
         if (Utility._IsGermany == true)
         {
             frmOTTOPro.UpdateStatus("Vorgang abgeschlossen: Speichern der Nutzerdaten");
         }
         else
         {
             frmOTTOPro.UpdateStatus("User Data Saved successfully");
         }
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Code to save Auto save checkbox status in database
        /// </summary>
        /// <param name="ObjEUserInfo"></param>
        /// <returns></returns>
        public EUserInfo UpdateAutoSave(EUserInfo ObjEUserInfo)
        {
            DataSet dsFeature = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Upd_AutoSave]";
                    cmd.Parameters.AddWithValue("@UserID", ObjEUserInfo.UserID);
                    cmd.Parameters.AddWithValue("@AutoSave", ObjEUserInfo.AutoSaveMode);
                    object Objreturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(Objreturn);
                    if (!string.IsNullOrEmpty(str))
                    {
                        throw new Exception(str);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While updating AutoSave Mode");
            }
            return(ObjEUserInfo);
        }
Exemplo n.º 3
0
        private void btnSaveFeature_Click(object sender, EventArgs e)
        {
            try
            {
                if (ObjEUserInfo == null)
                {
                    ObjEUserInfo = new EUserInfo();
                }
                DataTable _FeatureTable = ObjEUserInfo.dtFeature.Copy();
                foreach (DataColumn dc in ObjEUserInfo.dtFeature.Columns)
                {
                    if (dc.ColumnName != "FeatureID" && dc.ColumnName != "AccessLevelID")
                    {
                        _FeatureTable.Columns.Remove(dc.ColumnName);
                    }
                }

                ObjBUserInfo = new BUserInfo();
                ObjBUserInfo.SaveFeatureMap(ObjEUserInfo, _FeatureTable);
                if (Utility._IsGermany == true)
                {
                    frmOTTOPro.UpdateStatus("Berechtigungen für ausgewählte Rolle wurden gespeichert");
                }
                else
                {
                    frmOTTOPro.UpdateStatus("Features saved successfully for selected role");
                }
            }
            catch (Exception ex)
            {
                Utility.ShowError(ex);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 已经存在的手机不要发送
 /// </summary>
 /// <param name="Phone"></param>
 /// <returns></returns>
 private bool IsVerifiedPhone(string Phone)
 {
     using (OOContent db = new OOContent())
     {
         EUserInfo user = db.DBUserInfo.Where(a => a.Phone == Phone).FirstOrDefault();
         return(user != null);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Code to save User details while adding or editing from user master
        /// </summary>
        /// <param name="XmlDoc"></param>
        /// <param name="ObjEUserInfo"></param>
        /// <returns></returns>
        public int SaveUserDetails(XmlDocument XmlDoc, EUserInfo ObjEUserInfo)
        {
            int     UserID = -1;
            DataSet ds     = new DataSet();

            try
            {
                string innerxml = XmlDoc.InnerXml;
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Ins_UserInfo]";
                    SqlParameter param = new SqlParameter("@XMLUserInfo", SqlDbType.Xml);
                    param.Value = innerxml;
                    cmd.Parameters.Add(param);

                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(ds);
                    }
                    string str = ds.Tables[0].Rows[0][0] == DBNull.Value ? "" : ds.Tables[0].Rows[0][0].ToString();
                    if (!string.IsNullOrEmpty(str))
                    {
                        if (int.TryParse(str, out UserID))
                        {
                            ObjEUserInfo.UserID     = UserID;
                            ObjEUserInfo.dtUserInfo = ds.Tables[0];
                        }
                        else if (str.ToString().Contains("UNIQUE"))
                        {
                            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                            {
                                throw new Exception("Der Nutzername existiert bereits!");
                            }
                            else
                            {
                                throw new Exception("UserName is already exists.!");
                            }
                        }
                        else
                        {
                            throw new Exception(str);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                SQLCon.Close();
            }
            return(UserID);
        }
Exemplo n.º 6
0
        private void WXLoginCallBack(EUserInfo ui)
        {
            var userAccount = _UserSrv.GetUserAccount(ui.OpenId);

            CourseScheduleType courseScheduleType = _UserSrv.GetCurrentCourseScheduleType(ui.OpenId, ui.MemberType);

            bool isSkipTodayCourse = _UserSrv.IsSkipTodayUserCourse(ui.OpenId);

            base.SetUserSesion(ui.OpenId, ui.Name, ui.wx_headimgurl, ui.Phone, courseScheduleType, ui.UserRole, ui.MemberType, isSkipTodayCourse, userAccount);
        }
Exemplo n.º 7
0
        public static void TemplateTest()
        {
            using (UserContent db = new UserContent())
            {
                EUserInfo ui = db.Get("11");
                int       i  = 1;
            }

            //string template =JsonConvert.SerializeObject(data);
        }
Exemplo n.º 8
0
 public void O2OInitForAgent(EO2OOrder O2OOrder, EUserInfo ui)
 {
     this.AgentOpenId    = ui.OpenId;
     this.AgentName      = ui.Name;
     this.O2ONo          = O2OOrder.O2ONo;
     this.TargetAccount  = ui.AliPayAccount;
     this.TransDate      = DateTime.Now;
     this.TransDateStr   = DateTime.Now.ToShortDateString();
     this.TransferStatus = TransferStatus.Open;
     this.TransferTarget = TransferTarget.Agent;
 }
Exemplo n.º 9
0
 /// <summary>
 ///  Code to send request to DL while changing the USer's Password
 /// </summary>
 /// <param name="ObjEUserInfo"></param>
 /// <returns></returns>
 public EUserInfo ResetPassword(EUserInfo ObjEUserInfo)
 {
     try
     {
         ObjEUserInfo = ObjDUserInfo.ResetPassword(ObjEUserInfo);
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEUserInfo);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Code to send request to DL while check userinformation while logging in.
 /// </summary>
 /// <param name="ObjEUserInfo"></param>
 /// <returns></returns>
 public EUserInfo CheckUserCredentials(EUserInfo ObjEUserInfo)
 {
     try
     {
         ObjEUserInfo = ObjDUserInfo.CheckUserCredentials(ObjEUserInfo);
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEUserInfo);
 }
Exemplo n.º 11
0
        /// <summary>
        /// 扫码
        /// </summary>
        private void ScanHandler()
        {
            EUserInfo ui = _UserSrv.GetUserInfo(_wxMessage.FromUserName);

            if (ui != null)
            {
                _ResultMsg = _wxMessage.toText(WXReplyContent.UserComing(ui.wx_Name));
            }
            else
            {
                _ResultMsg = _wxMessage.toText(WXReplyContent.NewUserLook(ui.wx_Name));
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Code to validate user details while logging in
        /// </summary>
        /// <param name="ObjEUserInfo"></param>
        /// <returns></returns>
        public EUserInfo CheckUserCredentials(EUserInfo ObjEUserInfo)
        {
            DataSet dsFeature = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn2();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Get_CheckUserCredentials]";
                    cmd.Parameters.Add("@UserName", ObjEUserInfo.UserName);
                    cmd.Parameters.Add("@Password", ObjEUserInfo.Password);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dsFeature);
                    }
                    if (dsFeature != null && dsFeature.Tables.Count > 0)
                    {
                        string strUserID = dsFeature.Tables[0].Rows[0][0].ToString();
                        int    UserID    = 0;
                        if (int.TryParse(strUserID, out UserID))
                        {
                            ObjEUserInfo.dtUserDetails = dsFeature.Tables[0];
                            if (dsFeature.Tables.Count > 1)
                            {
                                ObjEUserInfo.dtFeature = dsFeature.Tables[1];
                                if (dsFeature.Tables.Count > 2)
                                {
                                    ObjEUserInfo.dtLVStatus = dsFeature.Tables[2];
                                    if (dsFeature.Tables.Count > 3)
                                    {
                                        ObjEUserInfo.dtPositionKZ = dsFeature.Tables[3];
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new Exception(strUserID);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Der Login konnte nicht erfolgen");
            }
            finally { SQLCon.Close2(); }
            return(ObjEUserInfo);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 被邀请用户首次进入公众号,绑定关系
        /// wxUser 因为获取方式不同
        /// </summary>
        /// <param name="wxMessage"></param>
        /// <param name="ownOpenId"></param>
        /// <returns></returns>
        public EUserInfo InvitedUserComing(string InvitedOpenId, string ownOpenId, WXUserInfo wxUser = null)
        {
            UserSrv   userSrv  = new UserSrv(_dbContext);
            SalesSrv  salesSrv = new SalesSrv(_dbContext);
            EUserInfo user     = null;

            try
            {
                if (wxUser == null)
                {
                    wxUser = WXApi.GetWXUserInfo(InvitedOpenId);
                }
            }
            catch (Exception ex)
            {
                NLogHelper.ErrorTxt($"businessSrv-[InvitedUserComing] -GetWXUserInfo Error:{ex.Message}");
                throw ex;
            }


            EUserInfo owner = null;

            try
            {
                //如果是老用户,不能绑定邀请
                if (!userSrv.IsExistUser(InvitedOpenId))
                {
                    owner = salesSrv.BindUser(ownOpenId, InvitedOpenId);
                }
            }
            catch (Exception ex)
            {
                NLogHelper.ErrorTxt($"businessSrv-[InvitedUserComing] -BindUser Error:{ex.Message}");
                throw ex;
            }

            try
            {
                user = userSrv.AddOrUpdateFromWXUser(wxUser, owner, false);
            }
            catch (Exception ex)
            {
                NLogHelper.ErrorTxt($"businessSrv-[InvitedUserComing] -AddOrUpdateFromWXUser Error:{ex.Message}");
                throw ex;
            }


            _dbContext.SaveChanges();
            return(user);
        }
Exemplo n.º 14
0
        private EUserInfo TryInvitedUserComing(string OpenId, WXUserInfo wXUser)
        {
            var       act = HttpContext.Request.Query["act"];
            EUserInfo ui  = null;

            if (act == "Invite")
            {
                string ownOpenId = HttpContext.Request.Query["OwnOpenId"];
                if (!string.IsNullOrEmpty(ownOpenId))
                {
                    ui = _BusinessSrv.InvitedUserComing(OpenId, ownOpenId, wXUser);
                }
            }
            return(ui);
        }
Exemplo n.º 15
0
 /// <summary>
 ///  Code to fetch User Roles from DL
 /// </summary>
 /// <param name="ObjEUserInfo"></param>
 /// <returns></returns>
 public EUserInfo GetUserRoles(EUserInfo ObjEUserInfo)
 {
     try
     {
         if (ObjEUserInfo != null)
         {
             ObjEUserInfo.dsUserRole = ObjDUserInfo.GetUserRoles();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEUserInfo);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Code to get access features list from DL
 /// </summary>
 /// <param name="ObjEUserInfo"></param>
 /// <returns></returns>
 public EUserInfo GetFeatureData(EUserInfo ObjEUserInfo)
 {
     try
     {
         if (ObjEUserInfo != null)
         {
             ObjEUserInfo = ObjDUserInfo.GetFeatureDetails(ObjEUserInfo);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEUserInfo);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Code to fetch user access levels from DL
 /// </summary>
 /// <param name="ObjEUserInfo"></param>
 /// <returns></returns>
 public EUserInfo GetAceesLevels(EUserInfo ObjEUserInfo)
 {
     try
     {
         if (ObjEUserInfo != null)
         {
             ObjEUserInfo = ObjDUserInfo.GetAceesLevels(ObjEUserInfo);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEUserInfo);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Code to send request to DL while saving Role feature map
 /// </summary>
 /// <param name="ObjEUserInfo"></param>
 /// <param name="dt"></param>
 /// <returns></returns>
 public EUserInfo SaveFeatureMap(EUserInfo ObjEUserInfo, DataTable dt)
 {
     try
     {
         if (ObjEUserInfo != null)
         {
             ObjEUserInfo = ObjDUserInfo.SaveFeatureMap(ObjEUserInfo, dt);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return(ObjEUserInfo);
 }
Exemplo n.º 19
0
        public void NewTecFromUser(EUserInfo user)
        {
            int count = _dbContext.DBTecInfo.Count(t => t.UserOpenId == user.OpenId);

            if (count == 0)
            {
                int No      = 0;
                var lastTec = _dbContext.DBTecInfo.OrderByDescending(a => a.Id).FirstOrDefault();
                if (lastTec != null)
                {
                    No = (int)lastTec.Id;
                }
                No++;
                //教师信息
                ETecInfo tec = new ETecInfo
                {
                    Sex             = user.Sex,
                    Code            = EduCodeGenerator.GetTecCode(No),
                    Name            = user.Name,
                    UserOpenId      = user.OpenId,
                    WxName          = user.wx_Name,
                    Phone           = user.Phone,
                    CreatedDateTime = DateTime.Now,
                    UpdatedDateTime = DateTime.Now,
                };

                //教师技能
                _dbContext.Database.ExecuteSqlRaw(TecSrv.sql_DeleteALLTecSkill(tec.Code));

                CourseSrv courseSrv  = new CourseSrv(this._dbContext);
                var       courseList = courseSrv.GetCourseType();
                foreach (var course in courseList)
                {
                    ETecSkill ts = new ETecSkill
                    {
                        CourseType = (CourseType)course.Key,
                        SkillLevel = SkillLevel.None,
                        TecCode    = tec.Code,
                    };

                    _dbContext.DBTecSkill.Add(ts);
                }

                _dbContext.DBTecInfo.Add(tec);
                _dbContext.Database.ExecuteSqlRaw(UserSrv.sql_UpdateUserRole(UserRole.Teacher, user.OpenId));
                _dbContext.SaveChanges();
            }
        }
Exemplo n.º 20
0
        public NResult <EUserInfo> Login(string loginName,
                                         string pwd,
                                         string DeviceIdentify       = "",
                                         string DeviceToken          = "",
                                         DeviceChannel DeviceChannel = DeviceChannel.IOS)
        {
            NResult <EUserInfo> result = new NResult <EUserInfo>();

            try
            {
                NLogHelper.InfoTxt(string.Format("用户{0}登陆,密码:{1},DeviceIdentify:{2}", loginName, pwd, DeviceIdentify));
                using (OOContent db = new OOContent())
                {
                    EUserInfo ui = db.DBUserInfo.Where(a => a.LoginName == loginName && a.Pwd == pwd).FirstOrDefault();
                    //var sql = @"select ui.Id,ui.NickName,
                    //                   ui.Phone,ui.UserRole,
                    //                   ui.HeaderImgUrl,
                    //                   ui.RecordStatus
                    //            from UserInfo as ui
                    //            where ui.LoginName = @LoginName and ui.Pwd = @Pwd";
                    //sql = string.Format(sql, loginName, pwd);
                    //List<SqlParameter> pList = new List<SqlParameter>();
                    //pList.Add(new SqlParameter("@LoginName", loginName));
                    //pList.Add(new SqlParameter("@Pwd", pwd));

                    //RUserInfo ui = db.Database.SqlQuery<RUserInfo>(sql, pList.ToArray()).FirstOrDefault();
                    if (ui == null)
                    {
                        result.ErrorMsg = "用户名或密码错误";
                        return(result);
                    }
                    else
                    {
                        ui.LastLoginDateTime = DateTime.Now;
                        //更新设备对应的手机
                        UpdateDevice(DeviceIdentify, loginName, db);
                        db.SaveChanges();
                    }
                    result.resultObj = ui;
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
                ErrorToDb(ex.Message);
            }
            return(result);
        }
Exemplo n.º 21
0
        public void InitFromUser(EUserInfo ui)
        {
            HasQRHuge        = ui.HasQRHuge;
            Id               = ui.Id;
            OpenId           = ui.OpenId;
            UserRole         = ui.UserRole;
            Headimgurl       = ui.Headimgurl;
            Name             = ui.Name;
            HasPassInviteFee = ui.HasPassInviteFee;
            HasQRHuge        = ui.HasQRHuge;
            O2OUserRole      = ui.O2OUserRole;
            AgentPhone       = ui.UserPhone;
            UserStatus       = ui.UserStatus;

            AliPayAccount = ui.AliPayAccount;
        }
Exemplo n.º 22
0
        /// <summary>
        /// Code to Change the user password from Profile
        /// </summary>
        /// <param name="ObjEUserInfo"></param>
        /// <returns></returns>
        public EUserInfo ResetPassword(EUserInfo ObjEUserInfo)
        {
            DataSet dsFeature = new DataSet();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.Sqlconn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[P_Upd_Password]";
                    cmd.Parameters.AddWithValue("@UserID", ObjEUserInfo.UserID);
                    cmd.Parameters.AddWithValue("@OldPassword", ObjEUserInfo.OldPassword);
                    cmd.Parameters.AddWithValue("@NewPassword", ObjEUserInfo.NewPassword);
                    cmd.Parameters.AddWithValue("@IsAdmin", ObjEUserInfo.IsAdmin);
                    object Objreturn = cmd.ExecuteScalar();
                    string str       = Convert.ToString(Objreturn);
                    if (!string.IsNullOrEmpty(str))
                    {
                        throw new Exception(str);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Valid"))
                {
                    if (System.Threading.Thread.CurrentThread.CurrentCulture.Name.ToString() == "de-DE")
                    {
                        throw new Exception("Bitte geben Sie das gültige alte Passwort ein");
                    }
                    else
                    {
                        throw new Exception("Please Enter Valid Old Password");
                    }
                }
                else
                {
                    throw new Exception("Fehler beim Zurücksetzen des Passworts");
                }
            }
            finally
            {
                SQLCon.Close();
            }
            return(ObjEUserInfo);
        }
Exemplo n.º 23
0
        public string PayF2F(EAliPayApplication app, EUserInfo AgentUi, EStoreInfo storeInfo, float TotalAmount, out ResultEnum status)
        {
            string result    = "";
            string NotifyUrl = ConfigurationManager.AppSettings["Main_SiteUrl"] + "AliPay/PayNotify";

            /*
             * IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(AliPayConfig.serverUrl, AliPayConfig.appId, AliPayConfig.merchant_private_key, AliPayConfig.version,
             *             AliPayConfig.sign_type, AliPayConfig.alipay_public_key, AliPayConfig.charset);
             */
            IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(app.ServerUrl, app.AppId, app.Merchant_Private_Key, app.Version,
                                                                            app.SignType, app.Merchant_Public_key, app.Charset);

            _handler = new F2FPayHandler();

            AlipayTradePrecreateContentBuilder builder = _handler.BuildPrecreateContent(app, AgentUi, storeInfo.AliPayAccount, TotalAmount.ToString());

            AlipayF2FPrecreateResult precreateResult = serviceClient.tradePrecreate(builder, NotifyUrl);

            status = precreateResult.Status;

            switch (precreateResult.Status)
            {
            case ResultEnum.SUCCESS:
                result = _handler.CreateQR(precreateResult);
                result = _handler.DeQR(result);

                break;

            case ResultEnum.FAILED:
                result = precreateResult.response.Body;

                break;

            case ResultEnum.UNKNOWN:
                if (precreateResult.response == null)
                {
                    result = "配置或网络异常,请检查后重试";
                }
                else
                {
                    result = "系统异常,请更新外部订单后重新发起请求";
                }

                break;
            }
            return(result);
        }
Exemplo n.º 24
0
 private void chkAutoSave1_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (!_TriggerFromLogin)
         {
             DUserInfo ObjDUserInfo = new DUserInfo();
             EUserInfo ObjEUserInfo = new EUserInfo();
             ObjEUserInfo.UserID       = Utility.UserID;
             ObjEUserInfo.AutoSaveMode = Convert.ToBoolean(chkAutoSave1.EditValue);
             ObjDUserInfo.UpdateAutoSave(ObjEUserInfo);
             Utility.AutoSave = ObjEUserInfo.AutoSaveMode;
         }
         _TriggerFromLogin = false;
     }
     catch (Exception ex) { Utility.ShowError(ex); }
 }
Exemplo n.º 25
0
        public OutAPIResult ModifyPwd()
        {
            string       phone  = HttpContext.Current.Request["Phone"];
            string       newPwd = HttpContext.Current.Request["newPwd"];
            string       oldPwd = HttpContext.Current.Request["oldPwd"];
            OutAPIResult result = new OutAPIResult();

            try
            {
                if (string.IsNullOrEmpty(phone))
                {
                    result.ErrorMsg = "手机号不能为空!";
                    return(result);
                }
                if (string.IsNullOrEmpty(newPwd))
                {
                    result.ErrorMsg = "新密码不能为空!";
                    return(result);
                }
                using (OOContent db = new OOContent())
                {
                    EUserInfo ui = db.DBUserInfo.Where(a => a.Phone == phone).FirstOrDefault();
                    if (ui == null)
                    {
                        result.ErrorMsg = "手机对应的用户没有找到";
                        return(result);
                    }
                    if (ui.Pwd != oldPwd)
                    {
                        result.ErrorMsg = "旧密码不匹配";
                        return(result);
                    }
                    else
                    {
                        ui.Pwd = newPwd;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }

            return(result);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 关注
        /// </summary>
        private void SubscribeHandler()
        {
            NLogHelper.InfoTxt("SubscribeHandler In");
            EUserInfo ui = _UserSrv.GetUserInfo(_wxMessage.FromUserName);

            if (ui == null)
            {
                var wxUser = WXApi.GetWXUserInfo(_wxMessage.FromUserName);
                ui = _UserSrv.AddOrUpdateFromWXUser(wxUser);

                _ResultMsg = _wxMessage.toText(WXReplyContent.NewUserAdd(ui.wx_Name));
            }
            else
            {
                _ResultMsg = _wxMessage.toText(WXReplyContent.UserComing(ui.wx_Name));
            }
        }
Exemplo n.º 27
0
        public string PayF2FNew(EAliPayApplication app, EUserInfo AgentUi, EStoreInfo storeInfo, string TotalAmount, out AliPayResult status)
        {
            string result      = "";
            bool   NeedControl = false;

            /*
             * IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(AliPayConfig.serverUrl, AliPayConfig.appId, AliPayConfig.merchant_private_key, AliPayConfig.version,
             *             AliPayConfig.sign_type, AliPayConfig.alipay_public_key, AliPayConfig.charset);
             */
            IAopClient aliyapClient = new DefaultAopClient("https://openapi.alipay.com/gateway.do", app.AppId,
                                                           app.Merchant_Private_Key, "json", "1.0", "RSA2", app.Merchant_Public_key, "GBK", false);


            _handler = new F2FPayHandler();

            //if (AgentUi.UserRole == UserRole.Administrator)
            //    NeedControl = false;
            AlipayTradePrecreateResponse builder = _handler.BuildNew(app, storeInfo, AgentUi, TotalAmount, true, NeedControl);

            if (builder.Code == "10000")
            {
                result = _handler.CreateF2FQR(builder.QrCode);
                result = _handler.DeQR(result);
                status = AliPayResult.SUCCESS;
            }
            else
            {
                if (builder.Code == "20001")
                {
                    status = AliPayResult.AUTHERROR;
                    result = "授权错误!";
                }
                else
                {
                    result = "[Error Message]" + builder.Msg + "[Sub Msg]" + builder.SubMsg;
                    status = AliPayResult.FAILED;
                }
            }


            return(result);
        }
Exemplo n.º 28
0
        public void InitByUser(EUserInfo ui)
        {
            this.InitCreate();
            this.InitModify();
            this.OwnnerOpenId = ui.OpenId;
            this.ParentOpenId = ui.OpenId;


            this.ReceiveStoreId = 1;
            this.Channel        = IQBCore.IQBPay.BaseEnum.Channel.League;
            this.Type           = IQBCore.IQBPay.BaseEnum.QRType.ARAuth;


            this.Name   = ui.Name;
            this.Remark = "[邀请码]" + ui.Name;
            if (ui.Name.Length > 40)
            {
                this.Name = this.Name.Substring(0, 40);
            }
        }
Exemplo n.º 29
0
        //先会判断是否被邀请过
        public EUserInfo BindUser(string ownOpenId, string invitedOpenId)
        {
            var       count = _dbContext.DBInviteLog.Where(a => a.InvitedOpenId == invitedOpenId).Count();
            EUserInfo owner = null;

            if (count == 0)
            {
                owner = _dbContext.DBUserInfo.Where(a => a.OpenId == ownOpenId).FirstOrDefault();
                EInviteLog log = new EInviteLog
                {
                    InvitedDateTime = DateTime.Now,
                    InvitedOpenId   = invitedOpenId,
                    InviteStatus    = InviteStatus.Invited,
                    OwnOpenId       = ownOpenId,
                    OwnName         = owner.Name,
                };
                _dbContext.DBInviteLog.Add(log);
            }
            return(owner);
        }
Exemplo n.º 30
0
        public ResultNormal CreateArt(InArtInfo inParameter)
        {
            ResultNormal result = new ResultNormal();

            try
            {
                if (string.IsNullOrEmpty(inParameter.unionId))
                {
                    result.ErrorMsg = "用户信息没有获取";
                    return(result);
                }

                EUserInfo ui = _UserSrv.GetUserInfoByUninonId(inParameter.unionId);
                if (ui == null)
                {
                    result.ErrorMsg = "unionId无效,请尝试登陆课程后,返回后再进入小程序";
                    return(result);
                }

                EArtInfo art = new EArtInfo()
                {
                    UnionId        = inParameter.unionId,
                    UploadUser     = ui.Name,
                    UploadDateTime = DateTime.Now,
                    CourseType     = inParameter.courseType,
                    Title          = inParameter.Title,
                    Desc           = inParameter.Desc,
                    ArtMediaType   = inParameter.ArtMediaType,
                    RecordStatus   = RecordStatus.PreData,
                };
                _WxMiniSrv.AddArtInfo(art);
                _WxMiniSrv.SaveChanges();
                result.IntMsg = art.Id;
            }
            catch (Exception ex)
            {
                result.ErrorMsg = "创建作品失败!";
                NLogHelper.ErrorTxt("WxAPI - [CreateArt]:" + ex.Message);
            }
            return(result);
        }