示例#1
0
        //首页活动  手机绑定
        public void AddAuthenticationMobile_Index(string authFrom, string userId, string mobile, string createBy)
        {
            using (var manager = new UserMobileManager())
            {
                //var other = manager.GetOtherUserMobile(mobile, userId);
                //if (other != null && other.IsSettedMobile)//判断手机号码的唯一性
                //{
                //    throw new ArgumentException(string.Format("此手机号【{0}】已被其他用户认证。", mobile));
                //}
                var mobileInfo = manager.GetMobileInfoByMobile(mobile);
                if (mobileInfo != null && !string.IsNullOrEmpty(mobileInfo.Mobile) && mobileInfo.UserId != userId)
                {
                    throw new ArgumentException(string.Format("此手机号【{0}】已被其他用户认证。", mobile));
                }
                //var entity = manager.GetUserMobile(userId);
                //if (entity != null && !string.IsNullOrEmpty(entity.Mobile) && !entity.IsSettedMobile)
                //{
                //    entity.Mobile = mobile;
                //    entity.IsSettedMobile = true;
                //    manager.UpdateUserMobile(entity);
                //    //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过手机认证", entity.CreateTime));
                //}
                if (mobileInfo != null && !string.IsNullOrEmpty(mobileInfo.Mobile) && !mobileInfo.IsSettedMobile)
                {
                    //mobileInfo.UserId = userId;
                    mobileInfo.UpdateBy       = userId;
                    mobileInfo.UpdateTime     = DateTime.Now;
                    mobileInfo.Mobile         = mobile;
                    mobileInfo.IsSettedMobile = true;
                    manager.UpdateUserMobile(mobileInfo);
                }
                else
                {
                    if (mobileInfo == null)
                    {
                        mobileInfo = new UserMobile
                        {
                            UserId         = userId,
                            User           = manager.LoadUser(userId),
                            AuthFrom       = authFrom,
                            Mobile         = mobile,
                            IsSettedMobile = true,
                            CreateBy       = createBy,
                            UpdateBy       = createBy,
                        };
                        manager.AddUserMobile(mobileInfo);

                        var gv  = new TaskListManager();
                        var old = gv.QueryTaskListByCategory(userId, TaskCategory.MobilBinding);
                        if (old == null)
                        {
                            //增加成长值
                            var orderId = Guid.NewGuid().ToString("N");
                            BusinessHelper.Payin_UserGrowth("绑定手机号", orderId, userId, 100, "完成手机号绑定可获得100点成长值");
                            gv.AddUserTaskRecord(new UserTaskRecord
                            {
                                CreateTime   = DateTime.Now,
                                CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                                OrderId      = orderId,
                                TaskCategory = TaskCategory.MobilBinding,
                                TaskName     = "绑定手机号",
                                UserId       = userId,
                            });
                            gv.AddTaskList(new TaskList
                            {
                                UserId       = userId,
                                OrderId      = orderId,
                                Content      = "完成手机号绑定可获得100点成长值",
                                ValueGrowth  = 100,
                                IsGive       = true,
                                VipLevel     = 0,
                                CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                                TaskCategory = TaskCategory.MobilBinding,
                                TaskName     = "绑定手机号",
                                CreateTime   = DateTime.Now,
                            });
                        }
                    }
                    else
                    {
                        throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过手机认证", mobileInfo.CreateTime));
                    }
                }
            }
        }
示例#2
0
        public string RegisterResponseMobile(string userId, string mobile, int delaySeconds, string delayDescription)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();

                var gv  = new TaskListManager();
                var old = gv.QueryTaskListByCategory(userId, TaskCategory.MobilBinding);
                if (old == null)
                {
                    //增加成长值
                    var orderId = Guid.NewGuid().ToString("N");
                    BusinessHelper.Payin_UserGrowth("绑定手机号", orderId, userId, 100, "完成手机号绑定可获得100点成长值");
                    gv.AddUserTaskRecord(new UserTaskRecord
                    {
                        CreateTime   = DateTime.Now,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        OrderId      = orderId,
                        TaskCategory = TaskCategory.MobilBinding,
                        TaskName     = "绑定手机号",
                        UserId       = userId,
                    });
                    gv.AddTaskList(new TaskList
                    {
                        UserId       = userId,
                        OrderId      = orderId,
                        Content      = "完成手机号绑定可获得100点成长值",
                        ValueGrowth  = 100,
                        IsGive       = true,
                        VipLevel     = 0,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        TaskCategory = TaskCategory.MobilBinding,
                        TaskName     = "绑定手机号",
                        CreateTime   = DateTime.Now,
                    });
                }

                using (var manager = new UserMobileManager())
                {
                    var entity = manager.GetUserMobile(userId);
                    if (entity != null)
                    {
                        if (entity.IsSettedMobile)
                        {
                            throw new ArgumentException(string.Format("已于【{0:yyyy-MM-dd HH:mm:ss}】进行过手机认证。", entity.UpdateTime));
                        }
                        var span = DateTime.Now - entity.UpdateTime.AddSeconds(delaySeconds);
                        if (span.TotalSeconds > 0)
                        {
                            throw new ArgumentException(string.Format("提交认证手机必须在请求认证后【{0}】内完成。", delayDescription));
                        }
                        entity.IsSettedMobile = true;
                        manager.UpdateUserMobile(entity);
                    }
                    else
                    {
                        entity = new UserMobile
                        {
                            UserId         = userId,
                            User           = manager.LoadUser(userId),
                            AuthFrom       = "LOCAL",
                            Mobile         = mobile,
                            IsSettedMobile = true,
                            CreateBy       = userId,
                            UpdateBy       = userId,
                        };
                        manager.AddUserMobile(entity);
                    }

                    mobile = entity.Mobile;
                }
                biz.CommitTran();
            }
            return(mobile);
        }
示例#3
0
 private void txtTieuDe_LostFocus(object sender, EventArgs eventArgs)
 {
     BusinessHelper.UpdateTieuDe(this.Name, txtTieuDe.Text);
 }
示例#4
0
        private void GetData()
        {
            string ReasonBy = "";

            string sAccountName = THU_VIEN_CHUNG.LayMaDviLamViec();

            LayThongTinPaymentDetail(sAccountName);
            //grdPaymentDetail.DataSource = m_dtPaymentDetail;


            SqlQuery sqlQuery = new Select().From(TPhieuthu.Schema)
                                .Where(TPhieuthu.Columns.PaymentId).IsEqualTo(Utility.Int32Dbnull(txtPayment_ID.Text)).And(
                TPhieuthu.Columns.LoaiPhieu).IsEqualTo(status);

            if (sqlQuery.GetRecordCount() <= 0)
            {
                TPayment objPayment = TPayment.FetchByID(Utility.Int32Dbnull(txtPayment_ID.Text, -1));
                if (objPayment != null)
                {
                    dtCreateDate.Value = Convert.ToDateTime(objPayment.PaymentDate);
                    txtPayment_ID.Text = Utility.sDbnull(objPayment.PaymentId, "-1");
                    txtMA_PTHU.Text    = BusinessHelper.GetMaPhieuThu(dtCreateDate.Value, 0);
                    Janus.Windows.GridEX.GridEXColumn gridExColumn = grdPaymentDetail.RootTable.Columns["TONG"];
                    txtSO_TIEN.Text        = Utility.sDbnull(grdPaymentDetail.GetTotal(gridExColumn, Janus.Windows.GridEX.AggregateFunction.Sum));
                    txtSLUONG_CTU_GOC.Text = "1";
                    TPatientInfo objPatientInfo = TPatientInfo.FetchByID(objPayment.PatientId);
                    if (objPatientInfo != null)
                    {
                        txtNGUOI_NOP.Text = objPatientInfo.PatientName;
                        label9.Text       = "Người nhận";
                    }
                    if (status == 0)
                    {
                        switch (sAccountName)
                        {
                        case "YHOCHAIQUAN":
                            ReasonBy        = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail);
                            txtLDO_NOP.Text = ReasonBy;
                            break;

                        case "KYDONG":
                            ReasonBy        = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail);
                            txtLDO_NOP.Text = ReasonBy;
                            break;

                        case "DETMAY":
                            LObjectType objectType = LObjectType.FetchByID(v_ObjectType_Id);
                            if (objectType.ObjectTypeType == 0)
                            {
                                txtLDO_NOP.Text = string.Format("Bệnh nhân cùng chi trả :{0} %", (100 - v_DiscountRate));
                            }
                            else
                            {
                                ReasonBy        = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail);
                                txtLDO_NOP.Text = ReasonBy;
                            }

                            break;

                        default:
                            ReasonBy        = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail);
                            txtLDO_NOP.Text = ReasonBy;
                            break;
                        }
                    }
                    if (status == 1)
                    {
                        ReasonBy        = "Trả lại tiền cho bệnh nhân";
                        txtLDO_NOP.Text = ReasonBy;
                    }
                }
            }
            else
            {
                var objPhieuthu = sqlQuery.ExecuteSingle <TPhieuthu>();
                if (objPhieuthu != null)
                {
                    txtSLUONG_CTU_GOC.Text = Utility.sDbnull(objPhieuthu.SluongCtuGoc, 1);
                    txtMA_PTHU.Text        = Utility.sDbnull(objPhieuthu.MaPthu, "");
                    txtNGUOI_NOP.Text      = Utility.sDbnull(objPhieuthu.NguoiNop);
                    txtSO_TIEN.Text        = Utility.sDbnull(objPhieuthu.SoTien);
                    txtTKHOAN_CO.Text      = Utility.sDbnull(objPhieuthu.TkhoanCo, "");
                    txtTKHOAN_NO.Text      = Utility.sDbnull(objPhieuthu.TkhoanNo, "");
                    txtLDO_NOP.Text        = objPhieuthu.LdoNop;
                    dtCreateDate.Value     = Convert.ToDateTime(objPhieuthu.NgayThien);
                }
            }
        }
示例#5
0
        void GetData()
        {
            try
            {
                patientExam =
                    new Select().From(TPatientExam.Schema).Where(TPatientExam.Columns.PatientCode).IsEqualTo(
                        txtPatientCode.Text).ExecuteSingle <TPatientExam>();
                if (patientExam != null)
                {
                    TPatientInfo patientInfo = TPatientInfo.FetchByID(patientExam.PatientId);

                    txtMaBenhNhan.Text     = Utility.sDbnull(patientInfo.PatientId, "");
                    txtMaLanKham.Text      = Utility.sDbnull(patientExam.PatientCode, "");
                    txtTenBenhNhan.Text    = Utility.sDbnull(patientInfo.PatientName, "");
                    txtDiaChiBenhNhan.Text = Utility.sDbnull(patientInfo.DiaChiBn, "");
                    txtTuoiBN.Text         = Utility.sDbnull(Utility.Int32Dbnull(BusinessHelper.GetSysDateTime().Year) - Utility.Int32Dbnull(patientInfo.YearOfBirth), -1);
                    txtDoiTuong.Text       = BusinessHelper.GetObjectTypeName(Utility.Int32Dbnull(patientExam.ObjectTypeId));
                    cmdMoKhoa.Enabled      = Utility.Int32Dbnull(patientExam.Locked) > 0;

                    switch (Utility.Int32Dbnull(patientExam.HosStatus, -1))
                    {
                    case 0:
                        txtTrangThaiBN.Text = "Ngoại trú";
                        break;

                    case 1:
                        txtTrangThaiBN.Text = "Nội trú";
                        break;

                    case 2:
                        txtTrangThaiBN.Text = "Đang chờ ra viện";

                        break;

                    case 3:
                        txtTrangThaiBN.Text = "Đã ra viện";
                        cmdMoKhoa.Enabled   = true;

                        break;
                    }
                    switch (Utility.Int32Dbnull(patientExam.Locked, 0))
                    {
                    case 0:
                        txtTrangthai.Text = "Chưa khóa";
                        break;

                    case 1:
                        txtTrangthai.Text = "Đã khóa";
                        break;
                    }
                    if (Utility.sDbnull(patientExam.MaDoiTuong, "") == "BHYT")
                    {
                        txtSoBHYT.Text     = Utility.sDbnull(patientExam.InsuranceNum, "");
                        txtDiaChiBHYT.Text = Utility.sDbnull(patientInfo.PatientAddr, "");
                    }
                    else
                    {
                        txtSoBHYT.Text     = "";
                        txtDiaChiBHYT.Text = "";
                    }
                    txtNgayVaoKham.Text = patientExam.InputDate.ToString("dd/MM/yyyy");
                }
                else
                {
                    CleanData();
                    Utility.SetMessageError(errorProvider1, txtPatientCode, "Không tồn tại bệnh nhân có mã lần khám đã nhập");
                }
            }
            catch (Exception)
            {
                Utility.ShowMsg("Có lỗi trong quá trình lấy thông tin bệnh nhân");
                throw;
            }
        }
        /// <summary>
        /// 豆豆兑换奖品
        /// </summary>
        public void ExchangeDouDou(string userId, int doudou, string password)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var userBalance = new UserBalanceManager().QueryUserBalance(userId);
                if (userBalance.CurrentDouDou < doudou)
                {
                    throw new Exception(string.Format("当前豆豆不足:{0},请继续努力!", doudou));
                }

                var order   = Guid.NewGuid().ToString("N");
                var manager = new A20140731_DouDouManager();
                switch (doudou)
                {
                case 1000:
                    //减去现金45元,加上奖金账户50元。
                    BusinessHelper.Payout_To_End(BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 45M, string.Format("用户{0}兑换红包", userId),
                                                 "ExchangeDouDou", password);
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆1000", userId));

                    //赠送50红包
                    BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 50M, string.Format("用户{0}兑换50元红包", userId));

                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 45M,
                        ActivityMoney = 50M,
                        Prize         = "购彩金",
                        PrizeMoney    = 5M,
                        IsGive        = true,
                        CreateTime    = DateTime.Now,
                    });
                    break;

                case 1800:
                    //减去现金90元,加上奖金账户100元。
                    BusinessHelper.Payout_To_End(BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 90M, string.Format("用户{0}兑换红包", userId), "ExchangeDouDou", password);
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆1800", userId));

                    //赠送100红包
                    BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 100M, string.Format("用户{0}兑换100元红包", userId));

                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 90M,
                        ActivityMoney = 100M,
                        Prize         = "购彩金",
                        PrizeMoney    = 10M,
                        IsGive        = true,
                        CreateTime    = DateTime.Now,
                    });
                    break;

                case 15000:
                    //减去现金900元,加上奖金账户1000元红包。
                    BusinessHelper.Payout_To_End(BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 900M, string.Format("用户{0}兑换红包", userId), "ExchangeDouDou", password);
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆15000", userId));
                    //赠送1000红包
                    BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 1000M, string.Format("用户{0}兑换1000元红包", userId));

                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 900M,
                        ActivityMoney = 1000M,
                        Prize         = "购彩金",
                        PrizeMoney    = 100M,
                        IsGive        = true,
                        CreateTime    = DateTime.Now,
                    });
                    break;

                case 150000:
                    //加上奖金账户1000元红元。
                    BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 1000M, string.Format("用户{0}兑换1000元红包", userId));
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆150000", userId));

                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 0M,
                        ActivityMoney = 1000M,
                        Prize         = "购彩金",
                        PrizeMoney    = 1000M,
                        IsGive        = true,
                        CreateTime    = DateTime.Now,
                    });
                    break;

                case 280000:
                    //加上奖金账户2000元红包。
                    BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_ExchangeDouDou, userId, order, 2000M, string.Format("用户{0}兑换2000元红包", userId));
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆280000", userId));

                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 0M,
                        ActivityMoney = 2000M,
                        Prize         = "购彩金",
                        PrizeMoney    = 2000M,
                        IsGive        = true,
                        CreateTime    = DateTime.Now,
                    });
                    break;

                case 500000:
                    //IPAD
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆500000", userId));
                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 0M,
                        ActivityMoney = 0M,
                        Prize         = "IPAD",
                        PrizeMoney    = 0M,
                        IsGive        = false,
                        CreateTime    = DateTime.Now,
                    });
                    break;

                case 1000000:
                    //Mac Book Air。
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆1000000", userId));
                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 0M,
                        ActivityMoney = 0M,
                        Prize         = "Mac Book Air",
                        PrizeMoney    = 0M,
                        IsGive        = false,
                        CreateTime    = DateTime.Now,
                    });

                    break;

                case 5000000:
                    //奇瑞QQ。
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆5000000", userId));
                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 0M,
                        ActivityMoney = 0M,
                        Prize         = "奇瑞QQ",
                        PrizeMoney    = 0M,
                        IsGive        = false,
                        CreateTime    = DateTime.Now,
                    });

                    break;

                case 10000000:
                    //比亚迪。
                    //扣除豆豆
                    BusinessHelper.Payout_OCDouDou(BusinessHelper.FundCategory_ExchangeDouDou, order, userId, doudou, string.Format("用户{0}兑换红包,消除豆豆10000000", userId));
                    manager.AddA20140731_DouDou(new A20140731_DouDou()
                    {
                        UserId        = userId,
                        DouDou        = doudou,
                        Money         = 0M,
                        ActivityMoney = 0M,
                        Prize         = "比亚迪",
                        PrizeMoney    = 0M,
                        IsGive        = false,
                        CreateTime    = DateTime.Now,
                    });

                    break;

                default:
                    break;
                }


                biz.CommitTran();
            }
        }
示例#7
0
        public ActionResult Report()
        {
            IQueryable <Flight> flights = _flightRepository.GetAllFlights();

            return(View(BusinessHelper.CalculateData(flights.ProjectTo <FlightViewModel>())));
        }
示例#8
0
        public JObject Registration(string sConnString, JObject paramObj, string clientIpAddr, string txnID, Boolean isResend, int countryID)
        {
            DataAccessLayer.V_1_2.Login_V120 loginObj = new DataAccessLayer.V_1_2.Login_V120(sConnString);
            DataSet        ds = new DataSet();
            JObject        jObj;
            JArray         jArr = new JArray();
            Int16          retVal = 0, isExisted = 0;
            string         retMessage = "", mobile = "";
            BusinessHelper businessHelperObj = new BusinessHelper();
            string         missedCallNumber  = "";

            if (countryID == 19)
            {
                missedCallNumber = ConfigurationManager.AppSettings["BahrainMissedCallNumber"].ToString();
            }
            else if (countryID == 239)
            {
                missedCallNumber = ConfigurationManager.AppSettings["UAEMissedCallNumber"].ToString();
            }
            else if (countryID == 241)
            {
                missedCallNumber = ConfigurationManager.AppSettings["USAMissedCallNumber"].ToString();
            }
            else
            {
                missedCallNumber = ConfigurationManager.AppSettings["IndiaMissedCallNumber"].ToString();
            }
            try
            {
                RegistrationDetails detailsObj = new RegistrationDetails();


                if (paramObj.SelectToken("MobileNumber") == null)
                {
                    jObj = new JObject(new JProperty("Success", false),
                                       new JProperty("Message", "Unable to read MobileNumber"),
                                       new JProperty("ErrorCode", "E0001"));
                    return(jObj);
                }
                mobile = paramObj.SelectToken("MobileNumber").ToString();
                businessHelperObj.GetOnlyNumeric(ref mobile);
                businessHelperObj.RemoveZeroPrefix(ref mobile);


                detailsObj.Mobile          = mobile;
                detailsObj.DeviceUniqueID  = paramObj.SelectToken("DeviceUniqueID").ToString();
                detailsObj.DeviceToken     = paramObj.SelectToken("DeviceToken").ToString();
                detailsObj.OsID            = Int16.Parse(paramObj.SelectToken("OsID").ToString());
                detailsObj.ClientIpAddress = clientIpAddr;
                detailsObj.TxnID           = txnID;

                if (isResend)
                {
                    detailsObj.IsResend = "Yes";
                }
                else
                {
                    detailsObj.IsResend = "";
                }


                ds = loginObj.Registration(detailsObj, out isExisted, out retVal, out retMessage);



                if (retVal == 1)
                {
                    jObj = new JObject(new JProperty("Success", true),
                                       new JProperty("IsExisted", isExisted),
                                       new JProperty("MissedCallNumber", missedCallNumber),
                                       new JProperty("Message", retMessage));
                }
                else
                {
                    jObj = new JObject(new JProperty("Success", false),
                                       new JProperty("Message", retMessage));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in LoginBusiness is " + ex.ToString());
                jObj = new JObject(new JProperty("Success", false),
                                   new JProperty("Message", "Something Went Wrong"),
                                   new JProperty("ErrorCode", "E0002"));
            }
            return(jObj);
        }
示例#9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DietMaster objDietMaster = PrepareDietMaster();

            objDietMaster.Operation  = 1;
            objDietMaster.CustomerID = 0;


            int i = 0;

            BusinessHelper <IDietMaster> .Use(DietMasterManager =>
            {
                i = DietMasterManager.ModifyDietMaster(objDietMaster);
            });

            if (i == 1)
            {
                MessageBox.Show("Added Successfully");
            }
            else
            {
                MessageBox.Show("Added Successfully");
            }

            /*
             *
             * //Add Customer Details
             * CustomerDetail objCustDetail = new CustomerDetail();
             * //objCustDetail.CustomerID = Convert.ToInt32(txtPatientID.Text);
             * //objCustDetail.CustomerName = txtPatientName.Text;
             * //objCustDetail.CustomerAge = Convert.ToInt32(txtPatientAge.Text);
             * //objCustDetail.Gender=cmbGender.SelectedIndex;
             * //objCustDetail.DOB = Convert.ToDateTime(txtDOB.Text);
             * //objCustDetail.Address = txtAddress.Text;
             * //objCustDetail.Profession = cmbProfession.SelectedItem.ToString();
             * //objCustDetail.Email = txtEmail.Text;
             * //objCustDetail.Contact = txtContact.Text;
             * //objCustDetail.PresentExercise = txtPresentExcercise.Text;
             * //objCustDetail.ExersizeActivity = txtExcerciseActivity.Text;
             * //objCustDetail.NatureOfActivity = cmbNatureOfActivity.SelectedItem.ToString();
             *
             * objCustDetail.CustomerID = 0;
             * objCustDetail.CustomerName = "Prashant";
             * objCustDetail.CustomerAge = 25;
             * objCustDetail.Gender = 0;
             * objCustDetail.DOB = Convert.ToDateTime("5/8/1989");
             * objCustDetail.Address = "Wadala";
             * objCustDetail.Profession = "Farming";
             * objCustDetail.Email = "*****@*****.**";
             * objCustDetail.Contact = "9867815161";
             * objCustDetail.PresentExercise = "Yoga";
             * objCustDetail.ExersizeActivity = "Padmasan";
             * objCustDetail.NatureOfActivity = "a. Sedentary( little or no exercise)";
             *
             * int i=0;
             * BusinessHelper<ICustomerDetail>.Use(CustomerDetailManager =>
             *  {
             *       i=CustomerDetailManager.ModifyCustomerDetail(objCustDetail);
             *  });
             * int c = i;
             *
             * //Add Anthropometrics details
             * Anthropometrics objAnthropometrics = new Anthropometrics();
             * objAnthropometrics.Operation = 1;
             *
             * //objAnthropometrics.CustomerID = 0;
             * //objAnthropometrics.MeasuredWeight = Convert.ToInt32(txtMeasuredWeight.Text);
             * //objAnthropometrics.MeasuredHeight = Convert.ToInt32(txtMeasuredHeight.Text);
             * //objAnthropometrics.IdealBodyWeight = Convert.ToInt32(txtIdealBodyWeight.Text);
             * //objAnthropometrics.CalculatedBMI = Convert.ToInt32(txtCalculatedBMI.Text);
             * //objAnthropometrics.BMICategory = cmbBMICategory.SelectedItem.ToString();
             * //objAnthropometrics.MeasuredWaist=Convert.ToInt32(txtMeasuredWaist.Text);
             * //objAnthropometrics.WeightGainInMonth = Convert.ToInt32(txtWeightGainInLastOneMonth.Text);
             * //objAnthropometrics.WeightGainInSixMonth=Convert.ToInt32(txtWeightGainInLastSixMonths.Text);
             * //objAnthropometrics.WeightGainInYear = Convert.ToInt32(txtWeightGainInLastYear.Text);
             * //objAnthropometrics.WeightLossInMonth = Convert.ToInt32(txtWeightGainInLastOneMonth.Text);
             * //objAnthropometrics.WeightGainInSixMonth = Convert.ToInt32(txtWeighLossInLastSixMonths.Text);
             * //objAnthropometrics.WeightLossInYear = Convert.ToInt32(txtWeighLossInLastYear.Text);
             * //objAnthropometrics.NeckCircumference = Convert.ToInt32(txtNeckCircumference.Text);
             * //objAnthropometrics.MUAC = Convert.ToInt32(txtMUAC.Text);
             * //objAnthropometrics.BloodPressure = Convert.ToInt32(txtBloodPressure.Text);
             *
             *
             * //dummy Data
             * objAnthropometrics.AnthropometricID = 0;
             * objAnthropometrics.CustomerID = 0;
             * objAnthropometrics.MeasuredWeight = 0;
             * objAnthropometrics.MeasuredHeight = 0;
             * objAnthropometrics.IdealBodyWeight = 0;
             * objAnthropometrics.CalculatedBMI = 0;
             * objAnthropometrics.BMICategory = "Normal BMI";
             * objAnthropometrics.MeasuredWaist = 0;
             * objAnthropometrics.WeightGainInMonth = 0;
             * objAnthropometrics.WeightGainInSixMonth = 0;
             * objAnthropometrics.WeightGainInYear = 0;
             * objAnthropometrics.WeightLossInMonth = 0;
             * objAnthropometrics.WeightGainInSixMonth = 0;
             * objAnthropometrics.WeightLossInYear = 0;
             * objAnthropometrics.NeckCircumference = 0;
             * objAnthropometrics.MUAC = 0;
             * objAnthropometrics.BloodPressure = 0;
             *
             * i = 0;
             * BusinessHelper<IAnthropometrics>.Use(AnthropometricsManager =>
             * {
             *  i = AnthropometricsManager.ModifyAnthropometrics(objAnthropometrics);
             * });
             *
             * //Add BioChemical Details
             *
             *
             * */
        }
        private void cboRegExam_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                txtSoLanKham.Text = Utility.sDbnull(cboRegExam.SelectedValue, -1);
                TRegExam objRegExam = TRegExam.FetchByID(Utility.Int32Dbnull(txtSoLanKham.Text));
                if (objRegExam != null)
                {
                    DataTable m_dtThongTin =
                        SPs.LaokhoaLaythongtinBenhnhanNgoaitruLankham(ObjPatientExam.PatientCode,
                                                                      Utility.Int32Dbnull(ObjPatientExam.PatientId, -1),
                                                                      Utility.Int32Dbnull(txtSoLanKham.Text)).GetDataSet
                            ().Tables[0];
                    if (m_dtThongTin.Rows.Count > 0)
                    {
                        DataRow dr = m_dtThongTin.Rows[0];
                        if (dr != null)
                        {
                            dtInput_Date.Value = Convert.ToDateTime(dr[TPatientExam.Columns.InputDate]);

                            txtExam_ID.Text       = Utility.sDbnull(objRegExam.RegId);
                            dtpCreatedDate.Value  = Convert.ToDateTime(objRegExam.RegDate);
                            txtDepartment_ID.Text = Utility.sDbnull(objRegExam.DepartmentId);
                            LDepartment objDepartment = LDepartment.FetchByID(Utility.Int32Dbnull(txtDepartment_ID.Text));
                            if (objDepartment != null)
                            {
                                txtDepartment_Name.Text = Utility.sDbnull(objDepartment.DepartmentName);
                            }
                            txtTenKham.Text = Utility.sDbnull(objRegExam.KieuKhambenh);
                            if (objRegExam.UserId == "ADMIN")
                            {
                                txtNguoiTiepNhan.Text = objRegExam.UserId;
                            }
                            else
                            {
                                LStaff lStaff = BusinessHelper.GetStaffByUserName(objRegExam.UserId);
                                if (lStaff != null)
                                {
                                    txtNguoiTiepNhan.Text = Utility.sDbnull(lStaff.StaffName);
                                }
                                else
                                {
                                    txtNguoiTiepNhan.Text = objRegExam.UserId;
                                }
                            }
                            if (Utility.Int32Dbnull(objRegExam.IdBsyThien, -1) <= 0)
                            {
                                cboDoctorAssign.SelectedValue = Utility.Int32Dbnull(objRegExam.IdBsyThien, -1);
                            }
                            else
                            {
                                cboDoctorAssign.SelectedIndex = 0;
                            }
                            //TExamInfo objExam = TExamInfo.FetchByID(Utility.Int32Dbnull(txtExam_ID.Text));
                            //if (objExam != null)
                            //{
                            //    txtKet_Luan.Text = Utility.sDbnull(objExam.KetLuan);
                            //    txtHuongdieutri.Text = objExam.HuongDieuTri;
                            //    nmrSongayDT.Value = Utility.DecimaltoDbnull(objExam.SoNgay, 0);
                            //    var objDiagInfo = new Select().From(TDiagInfo.Schema)
                            //        .Where(TDiagInfo.Columns.ExamId).IsEqualTo(objExam.ExamId).ExecuteSingle<TDiagInfo>();
                            //    if (objDiagInfo != null)
                            //    {
                            //        txtChanDoan.Text = Utility.sDbnull(objDiagInfo.DiagInfo);
                            //        txtMaBenhChinh.Text = Utility.sDbnull(objDiagInfo.MainDiseaseId);
                            //        string dataString = Utility.sDbnull(objDiagInfo.AuxiDiseaseId, "");
                            //        if (!string.IsNullOrEmpty(dataString))
                            //        {
                            //            dt_ICD_PHU.Clear();
                            //            string[] rows = dataString.Split(',');
                            //            foreach (string row in rows)
                            //            {
                            //                if (!string.IsNullOrEmpty(row))
                            //                {
                            //                    DataRow newDr = dt_ICD_PHU.NewRow();
                            //                    newDr["MA_ICD"] = row;
                            //                    newDr["TEN_ICD"] = GetTenBenh(row);
                            //                    dt_ICD_PHU.Rows.Add(newDr);
                            //                    dt_ICD_PHU.AcceptChanges();
                            //                }
                            //            }
                            //            grd_ICD.DataSource = dt_ICD_PHU;
                            //        }
                            //        else
                            //        {
                            //            dt_ICD_PHU.Clear();
                            //        }
                            //    }
                            //}
                            GetDataChiDinh();
                        }
                    }
                }
            }
            catch (Exception)
            {
                Utility.ShowMsg("Có lỗi trong quá trình lấy thông tin khám chữa bệnh");
            }
        }
示例#11
0
        public void DoSend()
        {
            int result = -1;

            try
            {
                isSending = true;
                string ErrMsg = "";
                _HWL.Url     = globalVariables.WebPath;
                _HWL.Timeout = 30000;
                _OnDoing("Đang đẩy-->" + PATIENT_CODE + "....", Color.Blue);
                result = _HWL.InsertPatient(GetHisInfo(Utility.Int32Dbnull(Assign_Id)), MA_CHIDINH, BusinessHelper.GetSysDateTime(), ref ErrMsg);
                if (result != 0)
                {
                    log.Error(PATIENT_CODE + "-->" + ErrMsg);
                }
                else
                {
                    log.Trace(PATIENT_CODE + "-->Đẩy dữ liệu vào Lablink thành công");
                }
                log.Trace("==============================================END=============================================");
                switch (result)
                {
                case -1:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Lỗi không xác định", Color.Red);

                    break;

                case 0:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Đẩy dữ liệu vào Lablink thành công", Color.Blue);
                    break;

                case 1:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Không tìm thấy bệnh nhân", Color.Red);
                    break;

                case 2:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Lỗi khi thêm bệnh nhân vào Lablink", Color.Red);
                    break;

                case 3:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Lỗi khi thêm chỉ định Lablink", Color.Red);
                    break;

                case 4:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Barcode đã được sử dụng cho bệnh nhân khác", Color.Red);
                    break;

                default:
                    _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Không xác định", Color.Red);
                    break;
                }
            }
            catch (Exception ex)
            {
                log.Error(PATIENT_CODE + "-->Lỗi ngoại lệ:\n" + ex.Message);
                _OnAction(result, MA_CHIDINH, Assign_Id, PATIENT_CODE, PATIENT_CODE + "-->Lỗi ngoại lệ:\n" + ex.Message, Color.Red);
            }
            finally
            {
                isSending = false;
            }
        }
        public void OrderPrize_AfterTranCommit(string userId, string schemeId, string gameCode, string gameType, string issuseNumber, decimal orderMoney, bool isBonus, decimal preTaxBonusMoney, decimal afterTaxBonusMoney, bool isVirtualOrder, DateTime prizeTime)
        {
            //if (isVirtualOrder) return;
            //if (!isBonus) return;
            //if (afterTaxBonusMoney <= 0) return;
            //if (afterTaxBonusMoney >= 10000M) return;

            //开启事务
            DB.Begin();
            try
            {
                var manager = new Sports_Manager();
                var order   = manager.QuerySports_Order_Complate(schemeId);
                if (order == null)
                {
                    throw new LogicException(string.Format("自动派钱,没有找到订单{0}", schemeId));
                }
                if (order.IsPrizeMoney)
                {
                    throw new LogicException(string.Format("订单{0}已派奖", schemeId));
                }

                order.IsPrizeMoney = true;
                manager.UpdateSports_Order_Complate(order);

                if (!order.IsVirtualOrder)
                {
                    if (order.SchemeType == (int)SchemeType.GeneralBetting || order.SchemeType == (int)SchemeType.ChaseBetting || order.SchemeType == (int)SchemeType.SingleCopy)
                    {
                        #region 普通、追号、抄单
                        if (order.AfterTaxBonusMoney > 0)
                        {
                            if (order.SchemeType == (int)SchemeType.SingleCopy)//抄单订单,派奖时需减去奖金提成的金额
                            {
                                var bdfxManager           = new BDFXManager();
                                var bdfxRecorSingleEntity = bdfxManager.QueryBDFXRecordSingleCopyBySchemeId(schemeId);
                                var realBonusMoney        = order.AfterTaxBonusMoney;
                                var commissionMoney       = 0M;
                                if (bdfxRecorSingleEntity != null)
                                {
                                    var BDFXEntity = bdfxManager.QueryTotalSingleTreasureBySchemeId(bdfxRecorSingleEntity.BDXFSchemeId);
                                    if (BDFXEntity != null)
                                    {
                                        //计算提成金额
                                        if ((order.AfterTaxBonusMoney - order.TotalMoney) > 0)
                                        {
                                            commissionMoney = (order.AfterTaxBonusMoney - order.TotalMoney) * BDFXEntity.Commission / 100M;
                                            commissionMoney = Math.Truncate(commissionMoney * 100) / 100M;
                                            realBonusMoney  = order.AfterTaxBonusMoney - commissionMoney;
                                            //返提成
                                            if (commissionMoney > 0)
                                            {
                                                BusinessHelper.Payin_To_Balance(AccountType.Bonus, BusinessHelper.FundCategory_BDFXCommissionMoney, BDFXEntity.UserId, schemeId, commissionMoney,
                                                                                string.Format("抄单订单{0}中奖{1:N2}元,提成{2:N0}%,获得奖金盈利提成金额{3:N2}元.", schemeId, order.AfterTaxBonusMoney, BDFXEntity.Commission, commissionMoney));
                                            }
                                        }
                                    }
                                }
                                //返奖金
                                BusinessHelper.Payin_To_Balance(AccountType.Bonus, BusinessHelper.FundCategory_Bonus, order.UserId, schemeId, realBonusMoney,
                                                                string.Format("抄单订单{0}中奖{1:N2}元,扣除奖金盈利提成金额{2:N2}元,实得奖金{3:N2}元.", schemeId, order.AfterTaxBonusMoney, commissionMoney, realBonusMoney));
                            }
                            else
                            {
                                BusinessHelper.Payin_To_Balance(AccountType.Bonus, BusinessHelper.FundCategory_Bonus, order.UserId, schemeId, order.AfterTaxBonusMoney,
                                                                string.Format("中奖奖金{0:N2}元.", order.AfterTaxBonusMoney));
                            }
                        }

                        if (order.AddMoney > 0)
                        {
                            BusinessHelper.Payin_To_Balance(order.AddMoneyDescription == "10" ? AccountType.Bonus : AccountType.RedBag, BusinessHelper.FundCategory_Bonus, order.UserId, schemeId, order.AddMoney,
                                                            string.Format("订单{0}活动赠送{1:N2}元.", schemeId, order.AddMoney));
                        }
                        #endregion
                    }
                    if (order.SchemeType == (int)SchemeType.TogetherBetting)
                    {
                        #region 合买
                        var main = manager.QuerySports_Together(schemeId);
                        if (order.AfterTaxBonusMoney > 0)
                        {
                            //提成
                            var deductMoney = 0M;
                            if (order.AfterTaxBonusMoney > main.TotalMoney)
                            {
                                deductMoney = (order.AfterTaxBonusMoney - main.TotalMoney) * main.BonusDeduct / 100;
                            }
                            //提成金额,只能给合买发起者
                            if (deductMoney > 0M)
                            {
                                BusinessHelper.Payin_To_Balance(AccountType.Bonus, BusinessHelper.FundCategory_Deduct, order.UserId, schemeId, deductMoney,
                                                                string.Format("订单{0}, 合买奖金盈利提成金额{1:N2}元。", schemeId, deductMoney));
                            }

                            //中奖金额,分发到所有参与合买的用户的奖金账户
                            var bonusMoney  = order.AfterTaxBonusMoney - deductMoney;
                            var singleMoney = bonusMoney / main.TotalCount;
                            foreach (var join in manager.QuerySports_TogetherSucessJoin(schemeId))
                            {
                                //if (join.JoinType == TogetherJoinType.SystemGuarantees) continue;//20151015屏蔽原代码,如果合买有系统保底,依然将奖金返还到系统保底账上
                                //发参与奖金
                                if (join.RealBuyCount <= 0)
                                {
                                    continue;
                                }
                                var joinMoney = join.RealBuyCount * singleMoney;
                                //派钱
                                if (joinMoney > 0M)
                                {
                                    BusinessHelper.Payin_To_Balance(AccountType.Bonus, BusinessHelper.FundCategory_Bonus, join.JoinUserId, schemeId, joinMoney,
                                                                    string.Format("中奖分成,奖金¥{0:N2}元。", joinMoney));
                                }
                            }
                        }
                        if (order.AddMoney > 0M)
                        {
                            //加奖金额分配给发起者
                            if (order.DistributionWay == (int)AddMoneyDistributionWay.CreaterOnly)
                            {
                                //加奖
                                if (order.AddMoney > 0)
                                {
                                    BusinessHelper.Payin_To_Balance(order.AddMoneyDescription == "10" ? AccountType.Bonus : AccountType.RedBag, BusinessHelper.FundCategory_Activity, order.UserId, schemeId, order.AddMoney,
                                                                    string.Format("订单{0}活动赠送{1:N2}元。", schemeId, order.AddMoney), RedBagCategory.Activity);
                                }
                            }
                            //处理加奖
                            if (order.DistributionWay == (int)AddMoneyDistributionWay.Average)
                            {
                                var addMonesinglePrice = order.AddMoney / main.TotalCount;
                                foreach (var join in manager.QuerySports_TogetherSucessJoin(schemeId))
                                {
                                    if (join.JoinType == (int)TogetherJoinType.SystemGuarantees)
                                    {
                                        continue;
                                    }

                                    if (join.RealBuyCount <= 0)
                                    {
                                        continue;
                                    }
                                    //发参与奖金
                                    var joinMoney = join.RealBuyCount * addMonesinglePrice;
                                    //派钱
                                    if (joinMoney > 0M)
                                    {
                                        BusinessHelper.Payin_To_Balance(order.AddMoneyDescription == "10" ? AccountType.Bonus : AccountType.RedBag, BusinessHelper.FundCategory_Activity, join.JoinUserId, schemeId, joinMoney,
                                                                        string.Format("订单{0}活动赠送{1:N2}元。", schemeId, joinMoney), RedBagCategory.Activity);
                                    }
                                }
                            }
                            //加奖金额分配给发起者
                            if (order.DistributionWay == (int)AddMoneyDistributionWay.JoinerOnly)
                            {
                                //订单发起者没有加奖
                                var joinList           = manager.QuerySports_TogetherSucessJoin(schemeId);
                                var createrList        = joinList.Where(p => p.JoinUserId == order.UserId).ToList();
                                var createJoinCount    = createrList.Count == 0 ? 0 : createrList.Sum(p => p.RealBuyCount);
                                var addMonesinglePrice = order.AddMoney / (main.TotalCount - createJoinCount);
                                foreach (var join in joinList)
                                {
                                    if (join.JoinType == (int)TogetherJoinType.SystemGuarantees)
                                    {
                                        continue;
                                    }
                                    if (join.JoinUserId == order.UserId)
                                    {
                                        continue;
                                    }

                                    if (join.RealBuyCount <= 0)
                                    {
                                        continue;
                                    }
                                    //发参与奖金
                                    var joinMoney = join.RealBuyCount * addMonesinglePrice;
                                    //派钱
                                    if (joinMoney > 0M)
                                    {
                                        BusinessHelper.Payin_To_Balance(order.AddMoneyDescription == "10" ? AccountType.Bonus : AccountType.RedBag, BusinessHelper.FundCategory_Activity, join.JoinUserId, schemeId, joinMoney,
                                                                        string.Format("订单{0}活动赠送{1:N2}元。", schemeId, joinMoney), RedBagCategory.Activity);
                                    }
                                }
                            }
                        }
                        #endregion
                    }

                    //添加最新中奖记录表
                    if (afterTaxBonusMoney >= 2000M)
                    {
                        var userInfo = new UserBalanceManager().QueryUserRegister(order.UserId);
                        if (userInfo != null)
                        {
                            new SiteActivityManager().AddLotteryNewBonus(new E_LotteryNewBonus
                            {
                                AfterTaxBonusMoney       = order.AfterTaxBonusMoney,
                                Amount                   = order.Amount,
                                CreateTime               = order.ComplateDateTime,
                                GameCode                 = order.GameCode,
                                GameType                 = order.GameType,
                                IssuseNumber             = order.IssuseNumber,
                                PlayType                 = order.PlayType,
                                PreTaxBonusMoney         = order.PreTaxBonusMoney,
                                SchemeId                 = order.SchemeId,
                                TotalMoney               = order.TotalMoney,
                                UserDisplayName          = userInfo.DisplayName,
                                HideUserDisplayNameCount = userInfo.HideDisplayNameCount
                            });
                        }
                    }
                }

                DB.Commit();


                //刷新用户在Redis中的余额
                if (afterTaxBonusMoney > 0M)
                {
                    BusinessHelper.RefreshRedisUserBalance(userId);
                }
            }
            catch (Exception ex)
            {
                DB.Rollback();
                throw ex;
            }
        }
示例#13
0
        /// <summary>
        /// 申请提现
        /// 实际添加提现记录,扣除用户资金
        /// </summary>
        public void RequestWithdraw_Step2(Withdraw_RequestInfo info, string userId, string password)
        {
            var userManager = new UserBalanceManager();
            var user        = userManager.QueryUserRegister(userId);

            if (!user.IsEnable)
            {
                throw new LogicException("用户已禁用");
            }


            DB.Begin();


            var            resonseMoney   = 0M;
            var            orderId        = BusinessHelper.GetWithdrawId();
            BusinessHelper businessHelper = new BusinessHelper();
            var            category       = businessHelper.Payout_To_Frozen_Withdraw(BusinessHelper.FundCategory_RequestWithdraw, userId, orderId, info.RequestMoney
                                                                                     , string.Format("申请提现:{0:N2}元", info.RequestMoney), "Withdraw", password, out resonseMoney);

            var fundManager = new FundManager();
            var addWithdraw = new C_Withdraw
            {
                OrderId        = orderId,
                BankCardNumber = info.BankCardNumber,
                BankCode       = info.BankCode,
                BankName       = info.BankName,
                BankSubName    = info.BankSubName,
                CityName       = info.CityName,
                RequestTime    = DateTime.Now,
                ProvinceName   = info.ProvinceName,
                UserId         = userId,
                RequestMoney   = info.RequestMoney,
                WithdrawAgent  = (int)info.WithdrawAgent,
                Status         = (int)WithdrawStatus.Requesting,

                WithdrawCategory = (int)category,
                ResponseMoney    = resonseMoney,
            };

            fundManager.AddWithdraw(addWithdraw);

            //查询到账金额
            var wi = GetWithdrawById(orderId);

            //判断DP是否可用
            var cacheDataBusiness = new CacheDataBusiness();
            var iscoreConfigInfo  = cacheDataBusiness.QueryCoreConfigByKey("DP.Isvailable");
            //获取当前系统时间(4-5点DP关闭)
            var      datetime    = System.DateTime.Now;
            var      nowHourAndM = datetime.ToString("t");
            var      datestar    = cacheDataBusiness.QueryCoreConfigByKey("DP.StartTime");
            var      dateend     = cacheDataBusiness.QueryCoreConfigByKey("DP.EndTime");
            DateTime dstar       = Convert.ToDateTime(datestar.ConfigValue);
            DateTime dend        = Convert.ToDateTime(dateend.ConfigValue);

            if (iscoreConfigInfo.ConfigValue == "1")
            {
                if (datetime <= dstar || datetime >= dend)
                {
                    //发送消息到DP
                    //判断是否发送到DP
                    String htmls = info.BankName;
                    //获取Dp提现最大限额
                    var coreConfigInfo = cacheDataBusiness.QueryCoreConfigByKey("DP.WithdrawHigthMoney");
                    //获取Dp给的公司编码
                    var coreConfigInfoC = cacheDataBusiness.QueryCoreConfigByKey("DP.Companyid");
                    //获取DP给的key
                    var ck = cacheDataBusiness.QueryCoreConfigByKey("DP.Key");
                    //获取DP访问路径
                    var     cw = cacheDataBusiness.QueryCoreConfigByKey("DP.WebUrl");
                    decimal withdrawHigthMoney = decimal.Parse(coreConfigInfo.ConfigValue);
                    //var writer = Common.Log.LogWriterGetter.GetLogWriter();
                    //writer.Write("关于DP日志", "关于DP日志", Common.Log.LogType.Information, "关于DP日志", "withdrawHigthMoney===============" + withdrawHigthMoney);

                    String str = String.Format("BankCardNumber=" + info.BankCardNumber + ",BankCode=" + info.BankCode + ",BankName=" + info.BankName + ",BankSubName=" + info.BankSubName + ",CityName=" + info.CityName + ",ProvinceName=" + info.ProvinceName + ",RequestMoney=" + info.RequestMoney + ",userRealName=" + info.userRealName + ",WithdrawAgent=" + info.WithdrawAgent + "");
                    //writer.Write("输出参数写测试用例", "输出参数写测试用例", Common.Log.LogType.Information, "输出参数写测试用例", "输出参数写测试用例===============" + str);
                    WithdrawApplyInfo wai = new WithdrawApplyInfo();
                    wai.company_order_num  = orderId;
                    wai.company_user       = userId;
                    wai.card_name          = info.userRealName;
                    wai.card_num           = info.BankCardNumber;
                    wai.issue_bank_name    = info.BankName;
                    wai.issue_bank_address = info.BankSubName;
                    wai.memo = "";
                    String amount = wi.ResponseMoney.ToString();
                    wai.amount = Math.Round(decimal.Parse(amount), 2);

                    wai.company_id = Int32.Parse(coreConfigInfoC.ConfigValue);
                    String  dpresult    = null;
                    decimal dpHighmoney = decimal.Parse(coreConfigInfo.ConfigValue);
                    if (info.RequestMoney < withdrawHigthMoney)
                    {
                        if (htmls.Contains("工商银行"))
                        {
                            int bankid = (int)BankCode.ICBC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("招商银行"))
                        {
                            int bankid = (int)BankCode.CMB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("建设银行"))
                        {
                            int bankid = (int)BankCode.CCB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("农业银行"))
                        {
                            int bankid = (int)BankCode.ABC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("中国银行"))
                        {
                            int bankid = (int)BankCode.BOC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("交通银行"))
                        {
                            int bankid = (int)BankCode.BCM;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("中国民生银行") || htmls.Contains("民生银行"))
                        {
                            int bankid = (int)BankCode.CMBC;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("中信银行"))
                        {
                            int bankid = (int)BankCode.ECC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("浦东发展银行") || htmls.Contains("浦发") || htmls.Contains("浦东"))
                        {
                            int bankid = (int)BankCode.SPDB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("邮政储蓄") || htmls.Contains("中国邮政"))
                        {
                            int bankid = (int)BankCode.PSBC;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("光大银行"))
                        {
                            int bankid = (int)BankCode.CEB;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("平安银行"))
                        {
                            int bankid = (int)BankCode.PINGAN;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("广东发展银行") || htmls.Contains("广发银行"))
                        {
                            int bankid = (int)BankCode.CGB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("华夏银行"))
                        {
                            int bankid = (int)BankCode.HXB;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("兴业银行"))
                        {
                            int bankid = (int)BankCode.CIB;
                            wai.bank_id = bankid.ToString();
                        }
                        else
                        {
                            var pListe = new List <string>();
                            pListe.Add(string.Format("{0}={1}", "[OrderId]", orderId));
                            pListe.Add(string.Format("{0}={1}", "[UserName]", user.DisplayName));
                            pListe.Add(string.Format("{0}={1}", "[RequestMoney]", info.RequestMoney));
                            pListe.Add(string.Format("{0}={1}", "[ResponseMoney]", resonseMoney));
                            //发送短信
                            new SiteMessageControllBusiness().DoSendSiteMessage(userId, "", "ON_User_Request_Withdraw", pListe.ToArray());
                            DB.Commit();
                            //刷新余额
                            BusinessHelper.RefreshRedisUserBalance(userId);
                            return;
                        }
                        dpresult = Withdrawal(wai, ck.ConfigValue, cw.ConfigValue);
                        if (dpresult == null || dpresult == "")
                        {
                            DB.Rollback();
                            throw new Exception("服务繁忙,请稍后重试,如多次尝试失败,请在客服服务时间内联系在线客服咨询");
                        }
                    }
                }
            }

            #region 发送站内消息:手机短信或站内信
            var pList = new List <string>();
            pList.Add(string.Format("{0}={1}", "[OrderId]", orderId));
            pList.Add(string.Format("{0}={1}", "[UserName]", ""));
            pList.Add(string.Format("{0}={1}", "[RequestMoney]", info.RequestMoney));
            pList.Add(string.Format("{0}={1}", "[ResponseMoney]", resonseMoney));
            //发送短信
            new SiteMessageControllBusiness().DoSendSiteMessage(userId, "", "ON_User_Request_Withdraw", pList.ToArray());

            #endregion

            DB.Commit();


            //刷新余额
            BusinessHelper.RefreshRedisUserBalance(userId);
        }
示例#14
0
        private void clientSub_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
        {
            try
            {
                Console.WriteLine(e.Topic);
                string data = System.Text.UTF8Encoding.UTF8.GetString(e.Message);
                Console.WriteLine(data);
                string[] topic      = e.Topic.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                Int64    recvTankId = Convert.ToInt64(topic[1].Substring(1));
                App.Log.LogDebugMessage(String.Format(@"Received Tank Id: {0}", recvTankId));
                JObject o       = JObject.Parse(data);
                UInt64  _level  = Convert.ToUInt64(o["fuel_level"]) / 100;
                UInt64  _wlevel = Convert.ToUInt64(o["water_level"]) / 100;
                UInt16  _thermo = Convert.ToUInt16(o["thermo"]);



                foreach (var _tank in CollecTank)
                {
                    if (_tank.TankId == recvTankId)
                    {
                        _tank.FuelLevel     = (Double)(_level) - _tank.OffsetLevel;
                        _tank.Capacity      = FuelInterpolation(_tank.FuelLevel, recvTankId);
                        _tank.WaterLevel    = _wlevel;
                        _tank.WaterCapacity = FuelInterpolation((Double)_wlevel, recvTankId);
                        _tank.Thermometer   = (Double)_thermo / 100;
                        if (!_tank.HasData)
                        {
                            _tank.HasData = true;
                            DataTable _dtTicket = BusinessHelper.FindLastTicketByTankId(_tank.TankId);
                            if (_dtTicket != null)
                            {
                                DataRow _dr          = _dtTicket.Rows[0];
                                Double  _endcapacity = Convert.ToDouble(_dr["endcapacity"]);
                                Double  _endlevel    = Convert.ToDouble(_dr["endlevel"]);
                                App.Log.LogDebugMessage(String.Format(@"Cap-Level: {0}-{1}", _endcapacity, _endlevel));
                                if ((_endcapacity == 0) && (_endlevel == 0))
                                {
                                    _tank.IsImportFinished = false;
                                    App.Log.LogDebugMessage(String.Format(@"Tank {0} doesn't finish importing!!!", _tank.TankId));
                                }
                            }
                        }
                        App.Log.LogDebugMessage(String.Format(_tank.CapacityText));
                        App.Log.LogDebugMessage(String.Format(_tank.WaterCapacityText));
                        App.Log.LogDebugMessage(String.Format(_tank.ThermoText));
                        break;
                    }
                }
                ObservableCollection <Model.TankModel> _FuelTanks = new ObservableCollection <Model.TankModel>(CollecTank);
                if (CollecTank != null)
                {
                    CollecTank = null;
                }

                CollecTank = _FuelTanks;
            }
            catch (Exception ex)
            {
                App.Log.LogException(ex);
            }
        }
示例#15
0
        private void DoImportFinish(UInt64 tankId)
        {
            var selTank = (from _tank in CollecTank
                           where _tank.TankId == (long)tankId
                           select _tank).FirstOrDefault() as TankModel;
            DateTime _now = DateTime.Now;

            try
            {
                if (App.Demo != 1)
                {
                    if (MessageBox.Show(String.Format(@"Kết thúc nhập bồn {0}", selTank.Description), @"Nhập nhiên liệu", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                    BusinessHelper.SaveTankData(selTank.TankId, selTank.Capacity, selTank.Thermometer, selTank.WaterCapacity, (Byte)SaveDataStatus.SAVE, _now);

                    DataTable dt = BusinessHelper.GetTankList(selTank.TankId);
                    foreach (DataRow _dr in dt.Rows)
                    {
                        long tankid = Convert.ToInt64(_dr["tankid"]);
                        //BusinessHelper.UpdateTankStatus(tankid);
                        BusinessHelper.UpdatePumpStatus(tankid);
                    }
                }


                DataTable    _dtReport     = BusinessHelper.FindLastTicketByTankId(selTank.TankId);
                ImportReport _importReport = new ImportReport();
                long         _ticketId     = -1;
                long         _tankId       = -1;
                if (_dtReport != null)
                {
                    DataRow _dr = _dtReport.Rows[0];
                    _ticketId = Convert.ToInt64(_dr["ticket_id"]);
                    _tankId   = Convert.ToInt64(_dr["tank_id"]);
                    _importReport.StationName    = selTank.StationName;
                    _importReport.ReportDate     = Convert.ToDateTime(_dr["ticketdate"]);
                    _importReport.DriverName     = Convert.ToString(_dr["drivername"]);
                    _importReport.CarPlate       = Convert.ToString(_dr["carplate"]);
                    _importReport.StaffName      = Convert.ToString(_dr["staffname"]);
                    _importReport.StaffPos       = Convert.ToString(_dr["staffpos"]);
                    _importReport.TemplateBottle = Convert.ToString(_dr["templatebottle"]);
                    _importReport.ImportCapacity = Convert.ToDouble(_dr["importcapacity"]);
                    long fuelId = Convert.ToInt64(_dr["fuel_id"]);
                    _importReport.Fuel = BusinessHelper.FindFuelById(fuelId);

                    _importReport.BeginCapacity  = Convert.ToDouble(_dr["capacity"]);
                    _importReport.BeginLevel     = Convert.ToDouble(_dr["level"]);
                    _importReport.BeginTotalPump = Convert.ToUInt64(_dr["pumptotal"]);
                    _importReport.ExStore        = Convert.ToString(_dr["exstore"]);
                    _importReport.SealId         = Convert.ToString(_dr["sealid"]);
                    _importReport.SealStatus     = Convert.ToBoolean(_dr["sealstatus"]);
                }
                else
                {
                    System.Windows.MessageBox.Show(@"Phiếu không tồn tại!!!", @"Kết thúc nhập bồn", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                    return;
                }
                _importReport.EndTotalPump = BusinessHelper.FindPumpTotalByTankId(selTank.TankId);
                _importReport.EndCapacity  = selTank.Capacity;
                _importReport.EndLevel     = selTank.FuelLevel;
                _importReport.RealCapacity = _importReport.EndCapacity - _importReport.BeginCapacity;

                if (!BusinessHelper.UpdateImportTicket(_ticketId, _importReport.EndTotalPump, _importReport.EndCapacity, _importReport.EndLevel))
                {
                    App.Log.LogInfoMessage(String.Format("Update ticket {0} failed", _ticketId));
                    System.Windows.MessageBox.Show(@"Lỗi trong quá trình cập nhật phiếu!!!", @"Kết thúc nhập bồn", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                    return;
                }
                else
                {
                    String _pubTopic = String.Format(@"importticket/{0}", _tankId);
                    String _pubData  = String.Format(@"{{""ticketId"": {0} }}", _ticketId);
                    if ((ClientPub != null) && (!ClientPub.IsConnected))
                    {
                        string pubClientId = Guid.NewGuid().ToString();


                        ClientPub.Connect(pubClientId, _MqttUser, _MqttPwd);
                    }
                    ClientPub.Publish(_pubTopic, Encoding.UTF8.GetBytes(_pubData), MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE, false);

                    selTank.IsImportFinished = true;

                    App.Log.LogDebugMessage("Topic: " + _pubTopic + "\t Data:" + _pubData);
                }



                ImportReportWindow    importReportWnd = new ImportReportWindow();
                ViewModelImportReport vmImportReport;
                if (App.Demo == 1)
                {
                    vmImportReport = new ViewModelImportReport();
                }
                else
                {
                    vmImportReport = new ViewModelImportReport(_importReport);
                }


                importReportWnd.DataContext = vmImportReport;
                importReportWnd.ShowDialog();
            }
            catch (Exception ex)
            {
                App.Log.LogException(ex);
            }
        }