Exemplo n.º 1
0
        /// <summary>
        /// 添加广告
        /// </summary>
        /// <param name="loginId">登录标识</param>
        /// <param name="exp">体验券</param>
        /// <returns>ResultDesc</returns>
        public ResultDesc AddAdvert(string loginId, Advert exp)
        {
            ResultDesc rsdc = new ResultDesc();
            var tdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期
                if (!ComFunction.ExistUserLoginID(loginId, ref tdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                #endregion
                var sqlList = new List<string>();
                sqlList.Add(string.Format("INSERT INTO [Trade_Advert]([ID]  ,[Url] ,[Creator] ,[CreateDate],[Status] ,[Remark],[Name]) VALUES ('{0}' ,'{1}' ,'{2}' ,'{3}' ,{4} ,'{5}','{6}')",
                    exp.ID, exp.Url, exp.Creator, exp.CreateDate, Convert.ToByte(exp.Status), exp.Remark, exp.Name));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加广告出错!";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加广告成功!";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "";
            }
            return rsdc;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 华夏银行签约,他行开户
        /// </summary>
        /// <param name="userid">用户ID</param>
        /// <param name="OpenBank">他行开户信息</param>
        /// <returns>签约结果</returns>
        public ResultDesc ContactToHuaxiaOhterBank(string userid, OpenBankInfo OpenBank)
        {
            ResultDesc rsdc = new ResultDesc();

            TradeUser TdUser = new TradeUser();
            try
            {
                #region 判断用户ID是否为空

                if(string.IsNullOrEmpty(userid))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户ID不能为空";
                    return rsdc;
                }
                #endregion
                TdUser = ComFunction.GetTradeUserByUserid(userid);
                //Fundinfo Fdinfo = ComFunction.GetFdinfo(string.Format("select * from Trade_FundInfo where userid='{0}' and state<>'4'", userid));
                string codeDesc = string.Empty;
                string subUser = string.Empty;
                //调用华夏银行子帐户同步接口
                if (!ComFunction.ContactToHuaxiaOhterBank(TdUser, OpenBank, ref codeDesc, ref subUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = string.Format("华夏银行签约,他行开户时,失败,华夏返回消息:{0}", codeDesc);
                    return rsdc;
                }

                //SQL语句
                List<string> sqlList = new List<string>();
                string sql1 = string.Format("update Trade_FundInfo set state='{0}',ConBankType='1',ConTime='{1}',BankAccount='{2}',AccountName='{3}',BankCard='{4}',OpenBank='{5}',OpenBankAddress='{6}',subUser='******' where userid='{7}' and state<>'{8}'",
                    2, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), OpenBank.BankAccount, OpenBank.AccountName, OpenBank.BankCard, OpenBank.OpenBank, OpenBank.OpenBankAddress, userid, 4, subUser);
                sqlList.Add(sql1);//0代表未签约 1表示审核中 2表示签约成功 3 表示失败 4表示已解约

                if (!ComFunction.SqlTransaction(sqlList))
                {
                     LogNet4.WriteMsg(string.Format("华夏银行签约,他行开户成功,但是SQL语句执行失败,SQL语句是:{0}",sql1));
                }
                rsdc.Result = true;
                rsdc.Desc = "华夏银行签约,他行开户时,成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "华夏银行签约,他行开户时,失败";
            }
            return rsdc;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 普通用户转经纪人
        /// </summary>
        /// <param name="loginId">登录ID</param>
        /// <param name="wUserId">微交易用户ID</param>
        /// <returns>ResultDesc</returns>
        public ResultDesc BecomeEconomicMan(string loginId, string wUserId)
        {
            var rsdc = new ResultDesc();
            var tdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期
                if (!ComFunction.ExistUserLoginID(loginId, ref tdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }

                #endregion
                string operUser = tdUser.Account;//操作人
                var sqlList = new List<string>();
                string uSql = string.Format(@"update Base_WUser set AccountType='4' where WUserId='{0}'", wUserId);
                sqlList.Add(uSql);

                //添加操作记录
                string ipmac = ComFunction.GetIpMac(tdUser.Ip, tdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)tdUser.UType, string.Format("{0}转经纪人", ipmac)));
                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "转经纪人出错!";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "转经纪人成功!";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "服务器返回错误";
            }
            return rsdc;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 2.3.4.5	添加客户到客户组
        /// </summary>
        /// <param name="account">客户账号</param>
        /// <param name="UserGroupId">客户组ID</param>
        /// <param name="LoginId"></param>
        /// <param name="tduser">添加成功后,返回的被添加的客户的信息</param>
        /// <returns></returns>
        public ResultDesc AddUserToUserGroups(string account, string UserGroupId, String LoginId, ref TradeUser tduser)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                List<string> sqlList = new List<string>();
                string UserId = ComFunction.GetUserId(account);
                if (string.IsNullOrEmpty(UserId))
                {
                    rsdc.Result = false;
                    rsdc.Desc = string.Format("帐号{0}不存在", account);
                    return rsdc;
                }
                if (ComFunction.ExistUserInTheGroup(UserId, UserGroupId))
                {
                    rsdc.Result = false;
                    rsdc.Desc = string.Format("帐号{0}已经添加到该组了", account);
                    return rsdc;
                }
                tduser = ComFunction.GetTradeUserByUserid(UserId);
                sqlList.Add(string.Format("delete from Trade_User_Group where UserId='{0}' ", UserId));
                sqlList.Add(string.Format("insert into Trade_User_Group(UserId, UserGroupId) values('{0}','{1}') ", UserId, UserGroupId));
                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加客户出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加客户成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加客户失败";
            }
            return rsdc;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 2.3.4.2	添加客户组
        /// </summary>
        /// <param name="ugs"></param>
        /// <param name="LoginId"></param>
        /// <returns></returns>
        public ResultDesc AddUserGroups(UserGroups ugs, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                if (string.IsNullOrEmpty(ugs.UserGroupName))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "客户组名称不能为空";
                    return rsdc;
                }
                List<string> sqlList = new List<string>();
                sqlList.Add(string.Format(@"insert into Trade_UserGroups(UserGroupId, UserGroupName, IsDefaultGroup, AfterSecond, PlaceOrderSlipPoint,
                                FlatOrderSlipPoint, DelayPlaceOrder, DelayFlatOrder) values('{0}','{1}',{2},{3},{4},{5},{6},{7}) ",
                                ugs.UserGroupId, ugs.UserGroupName, ugs.IsDefaultGroup, ugs.AfterSecond, ugs.PlaceOrderSlipPoint,
                                ugs.FlatOrderSlipPoint, ugs.DelayPlaceOrder, ugs.DelayFlatOrder));
                if (1 == ugs.IsDefaultGroup)//如果新加的组为默认组时,需要把其他组全部修改为非默认组
                {
                    sqlList.Add(string.Format("update Trade_UserGroups set IsDefaultGroup=0 where UserGroupId<>'{0}'", ugs.UserGroupId));
                }
                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加客户组出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加客户组成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加客户组失败";
            }
            return rsdc;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 解约处理-拒绝
        /// </summary>
        /// <param name="ApplyId"></param>
        /// <param name="LoginId"></param>
        /// <returns></returns>
        public ResultDesc RefusedJieYue(int ApplyId, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            int result = 0;
            System.Data.Common.DbParameter OutputParam = DbHelper.CreateDbParameter(JinTong.Jyrj.Data.DataBase.Type,
                "@Result", DbParameterType.Int, result, ParameterDirection.Output);
            try
            {
                TradeUser TdUser = new TradeUser();

                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_JieYue set ");

                strbld.AppendFormat("State=2, SHTime='{0}' ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                strbld.AppendFormat(" where ApplyId={0}", ApplyId);
                sqlList.Add(strbld.ToString());
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}解约处理-拒绝:ApplyId={0}", ApplyId, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "操作失败";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "操作成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "操作失败!";
            }
            return rsdc;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 解约处理-审核
        /// </summary>
        /// <param name="ApplyId"></param>
        /// <param name="userid"></param>
        /// <param name="LoginId"></param>
        /// <returns></returns>
        public ResultDesc ProcessJieYue(int ApplyId, string userid, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_JieYue set ");

                strbld.AppendFormat("State=1, SHTime='{0}' ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                strbld.AppendFormat(" where ApplyId={0}", ApplyId);
                sqlList.Add(strbld.ToString());
                //通过审核 需要把Trade_fundinfo表的state状态改为0 并且清空持卡人,银行卡号,开户行
                sqlList.Add(string.Format("update trade_fundinfo set state='0',AccountName='',BankCard='',OpenBank='' where userid='{0}'", userid));
                //sqlList.Add(string.Format("update trade_fundinfo set state='0' where userid='{0}'", userid));//不清空持卡人,银行卡号,开户行
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}解约处理-审核:ApplyId={0}", ApplyId, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "审核失败";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "审核成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "审核失败!";
            }
            return rsdc;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 手工调账或库存结算
        /// </summary>
        /// <param name="LoginId">登陆标识</param>
        /// <param name="TradeAccount">用户交易账号</param>
        /// <param name="money">调整资金</param>
        /// <param name="ReasonType">原因(3-库存结算,6-手工调账)</param>
        /// <returns>调整结果</returns>
        public ResultDesc ModifyUserMoney(string LoginId, string TradeAccount, double money, int ReasonType)
        {
            //ReasonType字段说明:(该接口取3,6)
            //0----入金(组织或管理员操作);
            //1----出金(组织或管理员操作);
            //2----订单操作
            //3----库存结算(组织或管理员操作);
            //4----银行入金 (用户操作);
            //5----银行出金 (用户操作)
            //6----手工调账(组织或管理员操作)
            //7----在线回购(用户操作);
            //8----其他费用;

            ResultDesc rsdc = new ResultDesc();
            string userid = string.Empty; //用户ID
            string operUser = string.Empty; //操作人

            TradeUser TdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion

                userid = ComFunction.GetUserId(TradeAccount);

                //获取现有资金信息
                Fundinfo Fdinfo = ComFunction.GetFdinfo(string.Format("select * from Trade_FundInfo where userid='{0}' and state<>'4'", userid));

                if (Fdinfo.Money + money < 0)
                {
                    rsdc.Result = false;
                    rsdc.Desc = string.Format("{0}失败!因为用户{1}现有余额为{2},调整金额为{3},调整后的金额小于0", 3 == ReasonType ? "库存结算" : "手工调账", TradeAccount, Fdinfo.Money, money);
                    return rsdc;
                }

                #region 数据库事务处理

                //SQL语句
                List<string> sqlList = new List<string>();

                //添加调整资金sql语句
                sqlList.Add(string.Format("update Trade_FundInfo set money=money+{0} where userid='{1}' and state<>'4'", money, userid));

                //添加资金变动记录sql语句
                sqlList.Add(string.Format("insert into Fund_Change([userId],[reason],[Oldvalue],[NewValue],[OperUser],[OperTime],[RelaOrder],[ChangeValue],[CashUser]) values('{0}','{1}',{2},{3},'{4}','{5}','{6}',{7},'{8}')", userid, ReasonType, Fdinfo.Money, Fdinfo.Money + money, operUser, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), string.Empty, money, Fdinfo.CashUser));

                string operrationDesc = string.Empty;
                if (3 == ReasonType)
                {
                    operrationDesc = string.Format("对用户{0},库存结算{1}", TradeAccount, money);
                }
                else if (6 == ReasonType)
                {
                    operrationDesc = string.Format("对用户{0},手工调帐{1}", TradeAccount, money);
                }
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, ipmac + operrationDesc));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "调整资金出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "调整资金成功";
                #endregion
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "调整资金失败";
            }
            return rsdc;
        }
Exemplo n.º 9
0
        /// <summary>
        /// 客户资金资料修改
        /// </summary>
        /// <param name="Fdinfo">资金信息</param>
        /// <param name="tradeAccount">用户帐号</param>
        /// <param name="LoginId">登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyUserFundinfo(Fundinfo Fdinfo, string tradeAccount, string LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            TradeUser RefTdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期
                if (!ComFunction.ExistUserLoginID(LoginId, ref RefTdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }

                if (UserType.NormalType == RefTdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = RefTdUser.Account;
                #endregion

                //SQL语句
                List<string> sqlList = new List<string>();
                string userid = ComFunction.GetUserId(tradeAccount);
                string strdt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                //构造修改用户信息的sql语句
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_FundInfo set ");

                //strbld.AppendFormat("ConBankType='{0}', ", string.IsNullOrEmpty(Fdinfo.ConBankType) ? string.Empty : Fdinfo.ConBankType);

                //strbld.AppendFormat("OpenBank='{0}', ", string.IsNullOrEmpty(Fdinfo.OpenBank) ? string.Empty : Fdinfo.OpenBank);
                //strbld.AppendFormat("BankAccount='{0}', ", string.IsNullOrEmpty(Fdinfo.BankAccount) ? string.Empty : Fdinfo.BankAccount);
                //strbld.AppendFormat("BankCard='{0}', ", string.IsNullOrEmpty(Fdinfo.BankCard) ? string.Empty : Fdinfo.BankCard);
                //strbld.AppendFormat("AccountName='{0}', ", string.IsNullOrEmpty(Fdinfo.AccountName) ? string.Empty : Fdinfo.AccountName);
                //strbld.AppendFormat("OpenBankAddress='{0}' ", string.IsNullOrEmpty(Fdinfo.OpenBankAddress) ? string.Empty : Fdinfo.OpenBankAddress);
                strbld.AppendFormat("DongJieMoney={0} ", Fdinfo.DongJieMoney);

                strbld.AppendFormat(" where userid='{0}' and [state]<>'4'", userid);
                sqlList.Add(strbld.ToString());
                //添加操作记录
                string ipmac = ComFunction.GetIpMac(RefTdUser.Ip, RefTdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)RefTdUser.UType,
                    string.Format("{2}修改{0}的冻结资金为{1}", tradeAccount, Fdinfo.DongJieMoney, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改用户资金资料出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修改用户资金资料成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改用户资金资料失败";
            }
            return rsdc;
        }
Exemplo n.º 10
0
        /// <summary>
        /// 修改交易日
        /// </summary>
        /// <param name="DtSet">交易日信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyDateSetEx(DateSet DtSet, string LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_DateSetEx set ");

                strbld.AppendFormat("Istrade={0},", DtSet.Istrade ? 0 : 1);
                strbld.AppendFormat("Starttime='{0}',", DtSet.Starttime);
                strbld.AppendFormat("Endtime='{0}',", DtSet.Endtime);
                strbld.AppendFormat("[Desc]='{0}'", DtSet.Desc);

                strbld.AppendFormat(" where pricecode='{0}' and Weekday='{1}'", DtSet.PriceCode, DtSet.Weekday);
                sqlList.Add(strbld.ToString());

                //添加操作记录
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType,
                    string.Format("{4}修改交易日{0}-{1},{2}-{3}", DtSet.PriceCode, DtSet.Weekday, DtSet.Starttime, DtSet.Endtime, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改交易日出错";
                    return rsdc;
                }
                if ("1" == ComFunction.InterType)
                {
                    ComFunction.ModifyDateSetEx(DtSet);
                }
                rsdc.Result = true;
                rsdc.Desc = "修该交易日成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改交易日失败";
            }
            return rsdc;
        }
Exemplo n.º 11
0
        /// <summary>
        /// 手动报价
        /// </summary>
        /// <param name="LoginId">登陆标识</param>
        /// <param name="PriceCode">行情编码</param>
        /// <param name="RealPrice">实时价</param>
        /// <returns>结果描述</returns>
        public ResultDesc ManualPrice(String LoginId, string PriceCode, double RealPrice)
        {
            ResultDesc rsdc = new ResultDesc();
            try
            {
                TcpClient client = new TcpClient();
                client.Connect(new IPEndPoint(IPAddress.Parse(ComFunction.recvip), Convert.ToInt32(ComFunction.recvport)));
                NetworkStream NetStream = client.GetStream();

                double water = 0;
                double rate = 1;
                double coefxs = 1;
                double coefficient = 1;
                if (!ComFunction.GetWaterAndRate(PriceCode, ref water, ref rate, ref coefxs, ref coefficient))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "手工报价遇到错误";
                    return rsdc;
                }
                RealPrice = ((RealPrice - water) / (coefficient * rate)) * coefxs;

                //数据格式:Manual + Tab键 + 行情编码 +Tab键 + 时间(yyyyMMddHHmmss) + Tab键 +开盘价 + Tab键 +最高价 + Tab键 + 最低价 +Tab键 + 收盘价 +Tab键 +成交量
                //Manual是手动报价标识
                string data = string.Format("Manual\t{0}\t{1}\t{2}\t{2}\t{2}\t{2}\t1", PriceCode, DateTime.Now.ToString("yyyyMMddHHmmss"), RealPrice);
                byte[] temp = Encoding.ASCII.GetBytes(string.Format("[datalen={0}]{1}", data.Length, data));

                NetStream.Write(temp, 0, temp.Length);
                NetStream.Flush();
                client.Close();
                NetStream.Close();
                rsdc.Result = true;
                rsdc.Desc = "手工报价成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "手工报价失败";
            }
            return rsdc;
        }
Exemplo n.º 12
0
        /// <summary>
        /// 添加商品信息
        /// </summary>
        /// <param name="TdProduct">商品信息信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>添加结果</returns>
        public ResultDesc AddTradeProduct(TradeProduct TdProduct, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                List<string> sqlList = new List<string>();
                TradeDataSource tdsource = ComFunction.GetTradeDataSource(TdProduct.Pricecode);
                //Goodscode用Pricecode赋值
                sqlList.Add(string.Format("insert into Trade_Product([ProductName],[productcode],[goodscode],[pricecode],[adjustbase],[adjustcount],[pricedot],[valuedot],[setBase],[holdbase],[expressionfee],[sellfee],[maxprice],[minprice],[maxtime],[Ordemoneyfee],[Ordemoney],[buystoragefee],[sellstoragefee],[state],[unit],[lowerprice],[starttime],[endtime]) values('{0}','{1}','{2}','{3}',{4},{5},{6},{7},{8},{9},'{10}','{11}',{12},{13},{14},'{15}',{16},'{17}','{18}','{19}',{20},{21},'{22}','{23}')",
                    TdProduct.ProductName, TdProduct.Productcode, TdProduct.Pricecode, TdProduct.Pricecode, TdProduct.Adjustbase, tdsource.adjustcount,
                    TdProduct.Pricedot, TdProduct.Valuedot, TdProduct.SetBase, TdProduct.Holdbase, TdProduct.Expressionfee, TdProduct.Sellfee, TdProduct.Maxprice,
                    TdProduct.Minprice, TdProduct.Maxtime, TdProduct.Ordemoneyfee, TdProduct.Ordemoney, TdProduct.Buystoragefee, TdProduct.Sellstoragefee,
                    TdProduct.State, TdProduct.Unit, TdProduct.Lowerprice, TdProduct.Starttime, TdProduct.Endtime));
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}添加商品信息:{0}", TdProduct.ProductName, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加商品信息出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加商品信息成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加商品信息失败";
            }
            return rsdc;
        }
Exemplo n.º 13
0
        /// <summary>
        /// 新闻公告添加
        /// </summary>
        /// <param name="TdNews">新闻</param>
        /// <param name="LoginId">登陆标识</param>
        /// <returns>添加结果</returns>
        public ResultDesc AddTradeNews(TradeNews TdNews, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion

                if (string.IsNullOrEmpty(TdNews.ID))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "ID不能为空";
                    return rsdc;
                }
                if (string.IsNullOrEmpty(TdNews.NewsTitle))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "标题不能为空";
                    return rsdc;
                }
                List<string> sqlList = new List<string>();
                sqlList.Add(string.Format("insert into Trade_News([ID],[NewsTitle],[NewsContent],[PubPerson],[PubTime],[Status],[NewsType],[OverView]) values('{0}','{1}','{2}','{3}','{4}',{5},{6},'{7}')", TdNews.ID, TdNews.NewsTitle, TdNews.NewsContent, TdNews.PubPerson, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), (int)TdNews.Status, (int)TdNews.NType, string.IsNullOrEmpty(TdNews.OverView) ? string.Empty : TdNews.OverView));
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}添加新闻公告:{0}", TdNews.NewsTitle, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加操作失败,请重试!";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加操作成功!";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加操作失败,请重试!";
            }
            return rsdc;
        }
Exemplo n.º 14
0
        /// <summary>
        /// 添加过滤Mac
        /// </summary>
        /// <param name="TdMac">过滤Mac信息</param>
        /// <param name="LoginId">管理员登陆标识</param>\
        /// <param name="ID">返回ID</param>
        /// <returns>添加结果</returns>
        public ResultDesc AddTradeMac(TradeMac TdMac, String LoginId, ref string ID)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                List<string> sqlList = new List<string>();
                ID = System.Guid.NewGuid().ToString().Replace("-", "");
                sqlList.Add(string.Format("insert into Trade_Mac([mac],[desc],[ID]) values('{0}','{1}','{2}')", TdMac.MAC, TdMac.Desc, ID));
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}添加过滤Mac:{0}", TdMac.ID, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加过滤Mac出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加过滤Mac成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加过滤Mac失败";

            }
            return rsdc;
        }
Exemplo n.º 15
0
 /// <summary>
 /// 编辑体验券
 /// </summary>
 /// <param name="loginId">登录标识</param>
 /// <param name="exp">体验券</param>
 /// <returns>ResultDesc</returns>
 public ResultDesc EditExperience(string loginId, Experience exp)
 {
     ResultDesc rsdc = new ResultDesc();
     var tdUser = new TradeUser();
     try
     {
         #region 判断登陆标识是否过期
         if (!ComFunction.ExistUserLoginID(loginId, ref tdUser))
         {
             rsdc.Result = false;
             rsdc.Desc = ResCode.UL003Desc;
             return rsdc;
         }
         #endregion
         var sqlList = new List<string>();
         exp.StartDate = exp.StartDate != null && exp.StartDate == DateTime.MinValue ? DateTime.MinValue : exp.StartDate;
         exp.EndDate = exp.EndDate != null && exp.EndDate == DateTime.MinValue ? DateTime.MinValue : exp.EndDate;
         exp.EffectiveTime = exp.EffectiveTime != null && exp.EffectiveTime == DateTime.MinValue ? DateTime.MinValue : exp.EffectiveTime;
         sqlList.Add(string.Format("UPDATE [TRADE_EXPERIENCE] SET [EX_NAME] ='{0}',[EX_TYPE] ={1},[EX_ANMOUNT] = {2} ,[EX_RECHARGE] ={3} ,[EX_NUM] = {4} ," +
                                   "[EX_STARTDATE] = '{5}',[EX_ENDDATE] = '{6}'  ,[EX_CREATID] ='{7}' ,[EX_EFFECTIVE] ={8} ,[EX_EFFECTIVETIME] ='{9}' WHERE ID ={10}",
                      exp.Name, exp.Type, exp.Annount, exp.Rceharge, exp.Num, exp.StartDate,
                      exp.EndDate, exp.CreatID, exp.Effective, exp.EffectiveTime,
                      exp.Id));
         if (!ComFunction.SqlTransaction(sqlList))
         {
             rsdc.Result = false;
             rsdc.Desc = "编辑体验券出错!";
             return rsdc;
         }
         rsdc.Result = true;
         rsdc.Desc = "编辑体验券成功!";
     }
     catch (Exception ex)
     {
         ComFunction.WriteErr(ex);
         rsdc.Result = false;
         rsdc.Desc = "";
     }
     return rsdc;
 }
Exemplo n.º 16
0
 /// <summary>
 /// 编辑广告
 /// </summary>
 /// <param name="loginId">登录标识</param>
 /// <param name="exp">广告</param>
 /// <returns>ResultDesc</returns>
 public ResultDesc EditAdvert(string loginId, Advert exp)
 {
     ResultDesc rsdc = new ResultDesc();
     var tdUser = new TradeUser();
     try
     {
         #region 判断登陆标识是否过期
         if (!ComFunction.ExistUserLoginID(loginId, ref tdUser))
         {
             rsdc.Result = false;
             rsdc.Desc = ResCode.UL003Desc;
             return rsdc;
         }
         #endregion
         var sqlList = new List<string>();
         sqlList.Add(string.Format("UPDATE [TradeDB].[dbo].[Trade_Advert] SET [Url] = '{0}',[Status] = {1},[Remark] ='{2}',[Name]='{3}' WHERE ID='{4}'", exp.Url, Convert.ToByte(exp.Status), exp.Remark, exp.Name, exp.ID));
         if (!ComFunction.SqlTransaction(sqlList))
         {
             rsdc.Result = false;
             rsdc.Desc = "编辑广告出错!";
             return rsdc;
         }
         rsdc.Result = true;
         rsdc.Desc = "编辑广告成功!";
     }
     catch (Exception ex)
     {
         ComFunction.WriteErr(ex);
         rsdc.Result = false;
         rsdc.Desc = "";
     }
     return rsdc;
 }
Exemplo n.º 17
0
        /// <summary>
        /// 修改客户资料
        /// </summary>
        /// <param name="TdUser">用户信息</param>
        /// <param name="Fdinfo">资金信息</param>
        /// <param name="LoginId">登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeUserEx(TradeUser TdUser, Fundinfo Fdinfo, string LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            TradeUser RefTdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期
                if (!ComFunction.ExistUserLoginID(LoginId, ref RefTdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }

                if (UserType.NormalType == RefTdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = RefTdUser.Account;
                #endregion

                if (string.IsNullOrEmpty(TdUser.Account))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户账号不能为空";
                    return rsdc;
                }
                if (string.IsNullOrEmpty(TdUser.LoginPwd))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户密码不能为空";
                    return rsdc;
                }

                //if (string.IsNullOrEmpty(TdUser.CardNum))
                //{
                //    rsdc.Result = false;
                //    rsdc.Desc = "证件号码不能为空";
                //    return rsdc;
                //}

                string OrgId = string.Empty;
                if (!string.IsNullOrEmpty(TdUser.OrgName))
                {
                    //判断组织ID是否存在
                    if (!ComFunction.ExistOrgName(TdUser.OrgName, ref OrgId))
                    {
                        rsdc.Result = false;
                        rsdc.Desc = "你所指定的组织名称不存在";
                        return rsdc;
                    }
                }
                //判断用户输入的证件号码在其他有效用户中是否已经被使用
                //if (ComFunction.CardNumIsExist(TdUser.Account, TdUser.CardNum))
                //{
                //    rsdc.Result = false;
                //    rsdc.Desc = "证件号码已经被使用";
                //    return rsdc;
                //}
                UserType Utype = ComFunction.GetUserType(TdUser.Account);
                //if (UserType.OrgType == Utype && !string.IsNullOrEmpty(OrgId) && !string.IsNullOrEmpty(TdUser.BindAccount))
                //{
                //    if (!ComFunction.ExistNormalAccount(TdUser.BindAccount, OrgId))
                //    {
                //        rsdc.Result = false;
                //        rsdc.Desc = "你所指定的绑定帐号不存在";
                //        return rsdc;
                //    }
                //}
                //if (UserType.NormalType == Utype && string.IsNullOrEmpty(TdUser.CashPwd))
                //{
                //    rsdc.Result = false;
                //    rsdc.Desc = "资金密码不能为空";
                //    return rsdc;
                //}
                //SQL语句
                List<string> sqlList = new List<string>();
                string userid = ComFunction.GetUserId(TdUser.Account);
                string strdt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                //构造修改用户信息的sql语句
                StringBuilder strbld = new StringBuilder();
                string ipmac = ComFunction.GetIpMac(RefTdUser.Ip, RefTdUser.Mac);
                //TdUser.OrderUnit = 1;//手数单位默认为1
                strbld.AppendFormat("update Base_User set ");

                strbld.AppendFormat("UserName='******',", string.IsNullOrEmpty(TdUser.UserName) ? string.Empty : TdUser.UserName);

                strbld.AppendFormat("CardNum='{0}',", string.IsNullOrEmpty(TdUser.CardNum) ? string.Empty : TdUser.CardNum);
                strbld.AppendFormat("OrgId='{0}',", string.IsNullOrEmpty(OrgId) ? string.Empty : OrgId);
                strbld.AppendFormat("PhoneNum='{0}',", string.IsNullOrEmpty(TdUser.PhoneNum) ? string.Empty : TdUser.PhoneNum);
                strbld.AppendFormat("TelNum='{0}',", string.IsNullOrEmpty(TdUser.TelNum) ? string.Empty : TdUser.TelNum);
                strbld.AppendFormat("Email='{0}',", string.IsNullOrEmpty(TdUser.Email) ? string.Empty : TdUser.Email);
                strbld.AppendFormat("LinkMan='{0}',", string.IsNullOrEmpty(TdUser.LinkMan) ? string.Empty : TdUser.LinkMan);
                strbld.AppendFormat("LinkAdress='{0}',", string.IsNullOrEmpty(TdUser.LinkAdress) ? string.Empty : TdUser.LinkAdress);
                strbld.AppendFormat("Sex='{0}',", string.IsNullOrEmpty(TdUser.Sex) ? "1" : TdUser.Sex);
                strbld.AppendFormat("[Status]='{0}',", string.IsNullOrEmpty(TdUser.Status) ? "0" : TdUser.Status);
                strbld.AppendFormat("LoginPwd='{0}',", Des3.Des3EncodeCBC(string.IsNullOrEmpty(TdUser.LoginPwd) ? "123456" : TdUser.LoginPwd));
                if (Utype == UserType.OrgType)
                {
                    strbld.AppendFormat("CardType='{0}',", string.IsNullOrEmpty(TdUser.CardType) ? "1" : TdUser.CardType);
                    strbld.AppendFormat("BindAccount='{0}',", string.IsNullOrEmpty(TdUser.BindAccount) ? string.Empty : TdUser.BindAccount);
                }
                else if (Utype == UserType.NormalType)
                {
                    strbld.AppendFormat("CardType='{0}',", string.IsNullOrEmpty(TdUser.CardType) ? "1" : TdUser.CardType);
                    strbld.AppendFormat("AccountType='{0}',", string.IsNullOrEmpty(TdUser.AccountType) ? "0" : TdUser.AccountType);
                    strbld.AppendFormat("OpenMan='{0}',", string.IsNullOrEmpty(TdUser.OpenMan) ? string.Empty : TdUser.OpenMan);
                    strbld.AppendFormat("OrderPhone='{0}',", string.IsNullOrEmpty(TdUser.OrderPhone) ? string.Empty : TdUser.OrderPhone);
                    strbld.AppendFormat("CashPwd='{0}',", Des3.Des3EncodeCBC(string.IsNullOrEmpty(TdUser.CashPwd) ? "123456" : TdUser.CashPwd));

                    strbld.AppendFormat("MinTrade={0},", TdUser.MinTrade);
                    strbld.AppendFormat("OrderUnit={0},", TdUser.OrderUnit);
                    strbld.AppendFormat("MaxTrade={0},", TdUser.MaxTrade);
                    strbld.AppendFormat("CorporationName='{0}',", string.IsNullOrEmpty(TdUser.CorporationName) ? string.Empty : TdUser.CorporationName);

                    strbld.AppendFormat("PermitRcash={0},", TdUser.PermitRcash ? 1 : 0);
                    strbld.AppendFormat("PermitCcash={0},", TdUser.PermitCcash ? 1 : 0);
                    strbld.AppendFormat("PermitDhuo={0},", TdUser.PermitDhuo ? 1 : 0);
                    strbld.AppendFormat("PermitHshou={0},", TdUser.PermitHshou ? 1 : 0);
                    strbld.AppendFormat("PermitRstore={0},", TdUser.PermitRstore ? 1 : 0);
                    strbld.AppendFormat("PermitDelOrder={0},", TdUser.PermitDelOrder ? 1 : 0);
                }
                strbld.AppendFormat("LastUpdateTime='{0}',", strdt); //修改时间
                strbld.AppendFormat("LastUpdateID='{0}'", operUser); //修改人
                strbld.AppendFormat(" where Account='{0}' and userid='{1}'", TdUser.Account, userid);
                sqlList.Add(strbld.ToString());
                //修改资金信息
                sqlList.Add(string.Format("update Trade_FundInfo set AccountName='{0}',BankCard='{1}',OpenBank='{2}',ConBankType='{4}' where userid='{3}'",
                    TdUser.UserName, Fdinfo.BankCard, Fdinfo.OpenBank, userid, Fdinfo.ConBankType));
                //com.individual.helper.LogNet4.WriteMsg(strbld.ToString());
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)RefTdUser.UType, string.Format("{1}修改用户{0}", TdUser.Account, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改用户资料出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修改用户资料成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改用户资料失败";
            }
            return rsdc;
        }
Exemplo n.º 18
0
        /// <summary>
        /// 修改节假日
        /// </summary>
        /// <param name="Hliday">节假日信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyHoliday(DateHoliday Hliday, string LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_HolidayEx set ");

                strbld.AppendFormat("Starttime='{0}',", Hliday.Starttime);
                strbld.AppendFormat("Endtime='{0}',", Hliday.Endtime);
                strbld.AppendFormat("[Desc]='{0}',", Hliday.Desc);
                strbld.AppendFormat("HoliName='{0}',", Hliday.HoliName);
                strbld.AppendFormat("pricecode='{0}' ", Hliday.PriceCode);
                strbld.AppendFormat(" where ID='{0}'", Hliday.ID);
                sqlList.Add(strbld.ToString());
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType,
                    string.Format("{3}修改节假日:{0},{1}-{2}", Hliday.ID, Hliday.Starttime, Hliday.Endtime, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改节假日出错";
                    return rsdc;
                }
                if ("1" == ComFunction.InterType)
                {
                    ComFunction.ModifyHoliday(Hliday);
                }
                rsdc.Result = true;
                //rsdc.Desc = "修该节假日成功";
                rsdc.Desc = strbld.ToString();
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改节假日失败";
            }
            return rsdc;
        }
Exemplo n.º 19
0
        /// <summary>
        /// 2.3.4.4	修改客户组
        /// </summary>
        /// <param name="ugs"></param>
        /// <param name="LoginId"></param>
        /// <returns></returns>
        public ResultDesc ModifyUserGroups(UserGroups ugs, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion

                if (string.IsNullOrEmpty(ugs.UserGroupName))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "客户组名称不能为空";
                    return rsdc;
                }
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.Append("update Trade_UserGroups set ");
                strbld.AppendFormat(" UserGroupName='{0}',", string.IsNullOrEmpty(ugs.UserGroupName) ? string.Empty : ugs.UserGroupName);
                strbld.AppendFormat(" IsDefaultGroup={0},", ugs.IsDefaultGroup);
                strbld.AppendFormat(" AfterSecond={0},", ugs.AfterSecond);
                strbld.AppendFormat(" PlaceOrderSlipPoint={0},", ugs.PlaceOrderSlipPoint);
                strbld.AppendFormat(" FlatOrderSlipPoint={0},", ugs.FlatOrderSlipPoint);
                strbld.AppendFormat(" DelayPlaceOrder={0},", ugs.DelayPlaceOrder);
                strbld.AppendFormat(" DelayFlatOrder={0} ", ugs.DelayFlatOrder);
                strbld.AppendFormat(" where UserGroupId='{0}'", ugs.UserGroupId);
                sqlList.Add(strbld.ToString());
                if (1 == ugs.IsDefaultGroup)//如果修改的组被设置为默认组时,需要把其他组全部修改为非默认组
                {
                    sqlList.Add(string.Format("update Trade_UserGroups set IsDefaultGroup=0 where UserGroupId<>'{0}'", ugs.UserGroupId));
                }
                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改客户组出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修改客户组成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改客户组失败";
            }
            return rsdc;
        }
Exemplo n.º 20
0
        /// <summary>
        /// 修改过滤Mac
        /// </summary>
        /// <param name="TdMac">过滤Mac信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeMac(TradeMac TdMac, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_Mac set ");

                strbld.AppendFormat("Mac='{0}',", TdMac.MAC);
                strbld.AppendFormat("[desc]='{0}'", TdMac.Desc);
                strbld.AppendFormat(" where ID='{0}'", TdMac.ID);
                sqlList.Add(strbld.ToString());

                //添加操作记录
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}修改过滤Mac:{0}", TdMac.ID, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改过滤Mac出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修该过滤Mac成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改过滤Mac失败";
            }
            return rsdc;
        }
Exemplo n.º 21
0
        /// <summary>
        /// 出金付款处理
        /// </summary>
        /// <param name="ApplyId"></param>
        /// <param name="LoginId"></param>
        /// <param name="state">处理状态,"1"-已付款,"2"已拒绝 "3"处理中 "4"处理失败</param>
        /// <returns></returns>
        public ResultDesc ProcessChuJin(int ApplyId, String LoginId,ref string state)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();

                #region 暂时作废
                //string ret_cod = string.Empty;
                //string ret_msg = string.Empty;
                //string ret_cod2 = string.Empty;//中间状态2000 2001 2003 2005 2007 2008
                //string ret_msg2 = string.Empty;
                //int itmp = 0;//临时变量
                //#region 调银行接口
                //ComFunction.ProcessChuJin(ApplyId, ref ret_cod, ref ret_msg, ref ret_cod2, ref ret_msg2);
                //#endregion

                //strbld.AppendFormat("update Trade_ChuJin set ");
                //if ("0000" == ret_cod && "0000" == ret_cod2)
                //{
                //    strbld.AppendFormat(" State=1, FkTime='{0}' ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                //    strbld.AppendFormat(" where ApplyId={0}", ApplyId);
                //    sqlList.Add(strbld.ToString());
                //}
                //else if ("2000" == ret_cod2 || "2001" == ret_cod2 || "2003" == ret_cod2 || "2005" == ret_cod2 || "2007" == ret_cod2 || "2008" == ret_cod2)
                //{
                //    strbld.AppendFormat(" FkTime='{0}',", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                //    strbld.AppendFormat(" State=3 where ApplyId={0}", ApplyId);//状态改为正在处理
                //    sqlList.Add(strbld.ToString());
                //    itmp = 1;
                //}
                ////失败代码0001 0002 1000 1001 1002 1999 2002 2004 2006
                //else if ("0001" == ret_cod2 || "0002" == ret_cod2 || "1000" == ret_cod2 || "1001" == ret_cod2 || "1002" == ret_cod2
                //    || "1999" == ret_cod2 || "2002" == ret_cod2 || "2004" == ret_cod2 || "2006" == ret_cod2)
                //{
                //    strbld.AppendFormat(" State=4, FkTime='{0}' ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                //    strbld.AppendFormat(" where ApplyId={0}", ApplyId);
                //    sqlList.Add(strbld.ToString());
                //    itmp = 2;
                //}
                //else
                //{
                //    rsdc.Result = false;
                //    rsdc.Desc = "付款失败!";
                //    return rsdc;
                //}
                #endregion

                #region 改为微信支付后,付款功能直接修改状态为处理中
                strbld.AppendFormat("update Trade_ChuJin set ");
                //strbld.AppendFormat(" FkTime='{0}',", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                if (ConfigurationManager.AppSettings["VersionFlag"] == "HFB")
                {
                    strbld.AppendFormat(" State=1 where ApplyId={0}", ApplyId); //状态改为已付款(黑琥珀)
                    state = "1";
                }

                else
                {
                    strbld.AppendFormat(" State=3 where ApplyId={0}", ApplyId);//状态改为正在处理
                    state = "3";
                }

                sqlList.Add(strbld.ToString());
                #endregion

                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}出金处理:ApplyId={0}", ApplyId, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    com.individual.helper.LogNet4.WriteMsg("付款已处理,但数据库sql执行失败了!");
                    state = "4";
                }
                rsdc.Result = true;
                rsdc.Desc = "处理中";
                //if (1 == itmp)
                //{
                //    rsdc.Desc = "3";//表示正在处理
                //}
                //else if (2 == itmp)
                //{
                //    rsdc.Desc = "4";//表示交易处理失败
                //}
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "付款失败!";
                state = "4";
            }
            return rsdc;
        }
Exemplo n.º 22
0
        /// <summary>
        /// 添加交易设置
        /// </summary>
        /// <param name="TdSet">交易设置信息</param>
        /// <param name="LoginId">登陆标识</param>
        /// <returns>添加结果</returns>
        public ResultDesc AddTradeSet(TradeSet TdSet, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                List<string> sqlList = new List<string>();
                sqlList.Add(string.Format("insert into Trade_Set([ObjName],[ObjCode],[ObjValue],[Remark]) values('{0}','{1}','{2}','{3}')", TdSet.ObjName, TdSet.ObjCode, TdSet.ObjValue, TdSet.Remark));

                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}添加交易设置:{0}", TdSet.ObjCode, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加交易设置出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加交易设置成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加交易设置失败";
            }
            return rsdc;
        }
Exemplo n.º 23
0
        /// <summary>
        /// 拒绝出金
        /// </summary>
        /// <param name="ApplyId"></param>
        /// <param name="LoginId"></param>
        /// <returns></returns>
        public ResultDesc RefusedChuJin(int ApplyId, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            int result = 0;
            System.Data.Common.DbParameter OutputParam = DbHelper.CreateDbParameter(JinTong.Jyrj.Data.DataBase.Type,
                "@Result", DbParameterType.Int, result, ParameterDirection.Output);
            try
            {
                TradeUser TdUser = new TradeUser();

                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                DbHelper.RunProcedureExecuteSql("Proc_RefusedChuJin",
                   new System.Data.Common.DbParameter[]{
                        DbHelper.CreateDbParameter(JinTong.Jyrj.Data.DataBase.Type,
                 "@ApplyID", DbParameterType.Int, ApplyId, ParameterDirection.Input),
                    DbHelper.CreateDbParameter(JinTong.Jyrj.Data.DataBase.Type,
                 "@OperUser", DbParameterType.String, operUser, ParameterDirection.Input),
                    OutputParam});
                result = Convert.ToInt32(OutputParam.Value);
                if (0 == result)
                {
                    rsdc.Result = false;
                    rsdc.Desc = "操作失败";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "操作成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "操作失败!";
            }
            return rsdc;
        }
Exemplo n.º 24
0
        /// <summary>
        /// 新闻公告修改
        /// </summary>
        /// <param name="TdNews">新闻</param>
        /// <param name="LoginId">登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeNews(TradeNews TdNews, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_News set ");

                strbld.AppendFormat("NewsContent='{0}',", TdNews.NewsContent);
                strbld.AppendFormat("NewsType={0},", (int)TdNews.NType);
                strbld.AppendFormat("Status={0},", (int)TdNews.Status);
                //  strbld.AppendFormat("PubTime='{0}',", TdNews.PubTime.ToString("yyyy-MM-dd"));
                strbld.AppendFormat("PubPerson='{0}',", TdNews.PubPerson);
                strbld.AppendFormat("OverView='{0}',", string.IsNullOrEmpty(TdNews.OverView) ? string.Empty : TdNews.OverView);

                strbld.AppendFormat("NewsTitle='{0}' ", TdNews.NewsTitle);
                strbld.AppendFormat(" where ID='{0}'", TdNews.ID);
                sqlList.Add(strbld.ToString());
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}修改新闻公告,{0}", TdNews.ID, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "保存出错,请重试!";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "保存成功!";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "保存出错,请重试!";
            }
            return rsdc;
        }
Exemplo n.º 25
0
        /// <summary>
        /// 新增交易用户
        /// </summary>
        /// <param name="TdUser">用户信息</param>
        /// <param name="Fdinfo">资金信息</param>
        /// <param name="UType">用户类型</param>
        /// <param name="LoginId">登陆标识</param>
        /// <returns>结果描述</returns>
        public ResultDesc AddTradeUserEx(TradeUser TdUser, Fundinfo Fdinfo, UserType UType, string LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            TradeUser RefTdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref RefTdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                #endregion

                if (UserType.NormalType == RefTdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = RefTdUser.Account;

                if (string.IsNullOrEmpty(TdUser.Account))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户账号不能为空";
                    return rsdc;
                }
                if (string.IsNullOrEmpty(TdUser.LoginPwd))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户密码不能为空";
                    return rsdc;
                }
                if (UserType.NormalType == UType && string.IsNullOrEmpty(TdUser.CashPwd))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "资金密码不能为空";
                    return rsdc;
                }
                if (string.IsNullOrEmpty(TdUser.CardNum))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "证件号码不能为空";
                    return rsdc;
                }
                if (string.IsNullOrEmpty(TdUser.UserID))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户ID不能为空";
                    return rsdc;
                }
                string OrgId = string.Empty;

                if (!string.IsNullOrEmpty(TdUser.OrgName))
                {
                    //判断组织ID是否存在
                    if (!ComFunction.ExistOrgName(TdUser.OrgName, ref OrgId))
                    {
                        rsdc.Result = false;
                        rsdc.Desc = "你所指定的组织名称不存在";
                        return rsdc;
                    }

                }

                bool tradeAccountExist = false;
                //判断用户账号 或 证件号码是否已经被使用
                if (ComFunction.CardNumIsExist(TdUser.Account, TdUser.CardNum, ref tradeAccountExist))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "证件号码已经被使用";
                    return rsdc;
                }
                if (tradeAccountExist)
                {
                    rsdc.Result = false;
                    rsdc.Desc = string.Format("账号{0}已经存在", TdUser.Account);
                    return rsdc;
                }

                if (UserType.OrgType == UType && !string.IsNullOrEmpty(OrgId) && !string.IsNullOrEmpty(TdUser.BindAccount))
                {
                    if (!ComFunction.ExistNormalAccount(TdUser.BindAccount, OrgId))
                    {
                        rsdc.Result = false;
                        rsdc.Desc = "你所指定的绑定帐号不存在";
                        return rsdc;
                    }
                }

                int ute = (int)UType;

                //SQL语句
                List<string> sqlList = new List<string>();

                StringBuilder strbld = new StringBuilder();
                //string userid = System.Guid.NewGuid().ToString().Replace("-", "");
                string strdt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                string ipmac = ComFunction.GetIpMac(RefTdUser.Ip, RefTdUser.Mac);
                //TdUser.OrderUnit = 1;//手数单位默认为1
                if (UserType.NormalType == UType)
                {
                    //构造新增基本用户信息的sql语句
                    strbld.AppendFormat(@"insert into Base_User([userId],[userName],[status],[Accounttype],[CorporationName],
                        [Account],[LoginPwd],[cashPwd],[CardType],[CardNum],[OrgId],[PhoneNum],[TelNum],[Email],[LinkMan],[LinkAdress],
                        [OrderPhone],[sex],[OpenMan],[OpenTime],[LastUpdateTime],[LastUpdateID],[LoginID],[Ip],[Mac],[Online],[MinTrade],
                        [OrderUnit],[MaxTrade],[PermitRcash],[PermitCcash],[PermitDhuo],[PermitHshou],[PermitRstore],[PermitDelOrder],
                        [UserType]) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',", TdUser.UserID, string.IsNullOrEmpty(TdUser.UserName) ? string.Empty : TdUser.UserName,
                                                                                  TdUser.Status, TdUser.AccountType, string.IsNullOrEmpty(TdUser.CorporationName) ? string.Empty : TdUser.CorporationName, TdUser.Account, Des3.Des3EncodeCBC(TdUser.LoginPwd), Des3.Des3EncodeCBC(TdUser.CashPwd));
                    strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}','{6}',", TdUser.CardType, TdUser.CardNum, string.IsNullOrEmpty(OrgId) ? string.Empty : OrgId,
                        TdUser.PhoneNum, TdUser.TelNum, TdUser.Email, TdUser.LinkMan);
                    strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',", TdUser.LinkAdress, TdUser.OrderPhone, TdUser.Sex, TdUser.OpenMan, strdt, strdt, operUser, string.Empty);
                    strbld.AppendFormat("'{0}','{1}',{2},{3},{4},{5},", string.Empty, string.Empty, 0, TdUser.MinTrade, TdUser.OrderUnit, TdUser.MaxTrade);
                    strbld.AppendFormat("{0},{1},{2},{3},{4},{5},{6})", TdUser.PermitRcash ? 1 : 0, TdUser.PermitCcash ? 1 : 0, TdUser.PermitDhuo ? 1 : 0, TdUser.PermitHshou ? 1 : 0, TdUser.PermitRstore ? 1 : 0, TdUser.PermitDelOrder ? 1 : 0, ute);
                    sqlList.Add(strbld.ToString());

                    //构造新增用户资金信息的sql语句
                    sqlList.Add(string.Format("insert into Trade_FundInfo([userId],[state],[money],[OccMoney],[frozenMoney],[BankAccount],[AccountName],[BankCard],[CashUser],[SubUser],[ConBankType],[OpenBank],[OpenBankAddress],[SameBank]) values('{0}','{1}',{2},{3},{4},'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}',{13})",
                        TdUser.UserID, 0, 0, 0, 0, string.Empty, TdUser.UserName, Fdinfo.BankCard, System.Guid.NewGuid().ToString().Replace("-", ""), string.Empty, Fdinfo.ConBankType, Fdinfo.OpenBank, string.Empty, 0));
                    //添加默认分组
                    string UserGroupId = ComFunction.GetUserGroupId();
                    if (!string.IsNullOrEmpty(UserGroupId))
                    {
                        sqlList.Add(string.Format("insert into Trade_User_Group(UserId, UserGroupId) values('{0}','{1}') ", TdUser.UserID, UserGroupId));
                    }
                    //添加操作记录
                    sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)RefTdUser.UType, string.Format("{1}新增账号{0}", TdUser.Account, ipmac)));
                }
                else if (UserType.AdminType == UType)
                {
                    //构造新增管理员信息的sql语句
                    strbld.AppendFormat(@"insert into Base_User([userId],[userName],[status],[Accounttype],[Account],[LoginPwd],
                                        [CardType],[CardNum],[PhoneNum],[TelNum],[Email],[LinkAdress],[sex],[OpenTime],
                                        [LastUpdateTime],[LastUpdateID],[Online],[UserType]) values('{0}','{1}','{2}','{3}','{4}','{5}',",
                                         TdUser.UserID, string.IsNullOrEmpty(TdUser.UserName) ? string.Empty : TdUser.UserName,
                                         TdUser.Status, 0, TdUser.Account, Des3.Des3EncodeCBC(TdUser.LoginPwd));
                    strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}',",
                                        1, TdUser.CardNum, TdUser.PhoneNum, TdUser.TelNum, TdUser.Email);
                    strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}',{5},{6})",
                                        TdUser.LinkAdress, TdUser.Sex, strdt, strdt, operUser, 0, ute);
                    sqlList.Add(strbld.ToString());

                    //添加操作记录
                    sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                        DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)RefTdUser.UType, string.Format("{1}新增管理员{0}", TdUser.Account, ipmac)));
                }
                else if (UType == UserType.OrgType)
                {
                    //构造新增组织用户信息的sql语句
                    strbld.AppendFormat(@"insert into Base_User([userId],[userName],[status],[Accounttype],[Account],[LoginPwd],
                                        [CardType],[CardNum],[OrgId],[PhoneNum],[TelNum],[Email],[LinkAdress],[sex],[OpenTime],
                                        [LastUpdateTime],[LastUpdateID],[Online],[UserType],[BindAccount])
                                        values('{0}','{1}','{2}','{3}','{4}','{5}',",
                                        TdUser.UserID, string.IsNullOrEmpty(TdUser.UserName) ? string.Empty : TdUser.UserName,
                                        TdUser.Status, 1, TdUser.Account, Des3.Des3EncodeCBC(TdUser.LoginPwd));
                    strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}',", TdUser.CardType, TdUser.CardNum, string.IsNullOrEmpty(OrgId) ? string.Empty : OrgId,
                        TdUser.PhoneNum, TdUser.TelNum, TdUser.Email);
                    strbld.AppendFormat("'{0}','{1}','{2}','{3}','{4}',{5},{6},'{7}')", TdUser.LinkAdress, TdUser.Sex, strdt, strdt, operUser, 0, ute, string.IsNullOrEmpty(TdUser.BindAccount) ? string.Empty : TdUser.BindAccount);
                    sqlList.Add(strbld.ToString());

                    //添加操作记录
                    sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)RefTdUser.UType, string.Format("{1}新增组织用户{0}", TdUser.Account, ipmac)));

                }

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "新增用户出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "新增用户成功";

            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "新增用户失败";
            }
            return rsdc;
        }
Exemplo n.º 26
0
        /// <summary>
        /// 修改商品信息
        /// </summary>
        /// <param name="TdProduct">商品信息信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeProduct(TradeProduct TdProduct, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;

                #endregion
                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_Product set ");
                strbld.AppendFormat("ProductName='{0}',", TdProduct.ProductName);
                strbld.AppendFormat("Adjustbase={0},", TdProduct.Adjustbase);
                //strbld.AppendFormat("Adjustcount={0},", TdProduct.Adjustcount);
                strbld.AppendFormat("Expressionfee='{0}',", TdProduct.Expressionfee);
                strbld.AppendFormat("Holdbase={0},", TdProduct.Holdbase);
                strbld.AppendFormat("Lowerprice={0},", TdProduct.Lowerprice);
                strbld.AppendFormat("Maxprice={0},", TdProduct.Maxprice);
                strbld.AppendFormat("Maxtime={0},", TdProduct.Maxtime);
                strbld.AppendFormat("Minprice={0},", TdProduct.Minprice);
                //strbld.AppendFormat("Ordemoney={0},", TdProduct.Ordemoney);
                strbld.AppendFormat("Ordemoneyfee='{0}',", TdProduct.Ordemoneyfee);
                strbld.AppendFormat("Pricedot={0},", TdProduct.Pricedot);
                //strbld.AppendFormat("Sellfee='{0}',", TdProduct.Sellfee);
                strbld.AppendFormat("Sellstoragefee='{0}',", TdProduct.Sellstoragefee);
                strbld.AppendFormat("SetBase={0},", TdProduct.SetBase);
                strbld.AppendFormat("State='{0}',", TdProduct.State);
                strbld.AppendFormat("Unit={0},", TdProduct.Unit);
                strbld.AppendFormat("Valuedot={0},", TdProduct.Valuedot);
                strbld.AppendFormat("Buystoragefee='{0}',", TdProduct.Buystoragefee);
                strbld.AppendFormat("Pricecode='{0}',", TdProduct.Pricecode);
                //strbld.AppendFormat("Goodscode='{0}',", TdProduct.Goodscode);
                strbld.AppendFormat("starttime='{0}',", TdProduct.Starttime);
                strbld.AppendFormat("endtime='{0}'", TdProduct.Endtime);
                strbld.AppendFormat(" where Productcode='{0}'", TdProduct.Productcode);
                sqlList.Add(strbld.ToString());
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}修改商品信息:{0}", TdProduct.ProductName, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改商品信息出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修该商品信息成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改商品信息失败";
            }
            return rsdc;
        }
Exemplo n.º 27
0
        /// <summary>
        /// 添加体验券
        /// </summary>
        /// <param name="loginId">登录标识</param>
        /// <param name="exp">体验券</param>
        /// <returns>ResultDesc</returns>
        public ResultDesc AddExperience(string loginId, Experience exp)
        {
            ResultDesc rsdc = new ResultDesc();
            var tdUser = new TradeUser();
            try
            {
                #region 判断登陆标识是否过期
                if (!ComFunction.ExistUserLoginID(loginId, ref tdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                #endregion
                var sqlList = new List<string>();
                sqlList.Add(string.Format("INSERT INTO [TRADE_EXPERIENCE]([EX_NAME] ,[EX_TYPE] ,[EX_ANMOUNT] ,[EX_RECHARGE] ,[EX_NUM] ,[EX_STARTDATE] ,[EX_ENDDATE] ," +
                             "[EX_CREATID] ,[EX_EFFECTIVE],[EX_EFFECTIVETIME]) VALUES ('{0}',{1},{2},{3},{4},'{5}','{6}','{7}',{8},'{9}')",
                             exp.Name, exp.Type, exp.Annount, exp.Rceharge, exp.Num, exp.StartDate,
                             exp.EndDate, exp.CreatID, exp.Effective, exp.EffectiveTime
                    ));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加体验券出错!";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加体验券成功!";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "";
            }
            return rsdc;
        }
Exemplo n.º 28
0
        /// <summary>
        /// 修改汇率和水
        /// </summary>
        /// <param name="TdRate">汇率和水信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeRate(TradeRate TdRate, String LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion
                List<string> sqlList = new List<string>();

                int result = ComFunction.ModifyWaterAndRate(TdRate);

                //添加操作记录
                if (1 == result)
                {
                    string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                    sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                        DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}修改汇率和水:{0}", TdRate.PriceCode, ipmac)));

                    if (!ComFunction.SqlTransaction(sqlList))
                    {
                        rsdc.Result = false;
                        rsdc.Desc = "修改汇率和水出错1";
                        return rsdc;
                    }
                    rsdc.Result = true;
                    rsdc.Desc = "修该汇率和水成功";
                }
                else
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改汇率和水出错2";
                    return rsdc;
                }
            }
            catch (Exception ex)
            {
                rsdc.Result = false;
                rsdc.Desc = "修改汇率和水失败";
            }
            return rsdc;
        }
Exemplo n.º 29
0
        private void Save()
        {
            TradeNews news = new TradeNews();
            news.NewsTitle = txtTitle.Text;
            news.OverView = txtOverView.Text;
            news.NewsContent = NewsContent.InnerText;
            if (string.IsNullOrEmpty(news.NewsContent))
            {
                MessageBox("请填写内容!");
                return;
            }
            if (string.IsNullOrEmpty(news.NewsTitle))
            {
                MessageBox("请填写标题!");
                return;
            }
            if (string.IsNullOrEmpty(news.OverView))
            {
                MessageBox("请填写摘要!");
                return;
            }
            if (news.NewsContent.Length > 4000)
            {
                MessageBox("内容不能超过4000字符!");
                return;
            }
            if (news.NewsTitle.Length > 200)
            {
                MessageBox("标题不能超过200字符!");
                return;
            }
            if (news.OverView.Length > 2000)
            {
                MessageBox("摘要不能超过2000字符!");
                return;
            }
            int type = 0;
            if (!string.IsNullOrEmpty(ddlType.SelectedItem.Value))
            {
                type = int.Parse(ddlType.SelectedItem.Value);
            }
            else
            {
                MessageBox("请选择新闻类型!");
                return;
            }
            news.NType = (NewsType)type;
            news.PubPerson = Account;
            int status=1;
            status=rbEnable.Checked ? 1 : 0;
            news.Status = (NewsStatus)status;

            ResultDesc result = new ResultDesc();

            if (string.IsNullOrEmpty(ID))
            {
             news.ID = Guid.NewGuid().ToString("n");
             result=   GetManager.AddTradeNews(news, LoginId);
            }
            else
            {
                news.ID = ID;
                result = GetManager.ModifyTradeNews(news, LoginId);
            }
            MessageBox(result.Desc);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 修改交易设置
        /// </summary>
        /// <param name="TdSet">交易设置</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeSet(TradeSet TdSet, string LoginId)
        {
            ResultDesc rsdc = new ResultDesc();
            string operUser = string.Empty;//操作人
            try
            {
                TradeUser TdUser = new TradeUser();
                #region 判断登陆标识是否过期

                if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = ResCode.UL003Desc;
                    return rsdc;
                }
                if (UserType.NormalType == TdUser.UType)
                {
                    rsdc.Result = false;
                    rsdc.Desc = ComFunction.NotRightUser;
                    return rsdc;
                }
                operUser = TdUser.Account;
                #endregion

                #region 验证数据
                if (!ComFunction.ValidateTradeSet(TdSet))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "值不正确";
                    return rsdc;
                }
                #endregion

                List<string> sqlList = new List<string>();
                StringBuilder strbld = new StringBuilder();
                strbld.AppendFormat("update Trade_Set set ");

                strbld.AppendFormat("ObjName='{0}',", TdSet.ObjName);
                strbld.AppendFormat("ObjValue='{0}',", TdSet.ObjValue);
                strbld.AppendFormat("Remark='{0}' ", TdSet.Remark);
                strbld.AppendFormat("where ObjCode='{0}'", TdSet.ObjCode);
                sqlList.Add(strbld.ToString());
                string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac);
                //添加操作记录
                sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}修改交易设置,{0}", TdSet.ObjCode, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改交易设置出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修该交易设置成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改交易设置失败";
            }
            return rsdc;
        }