public ActionResult Collection(string shoukuanid, string shoukuanshijian, string shoukuanxiangqing)
 {
     if (!string.IsNullOrEmpty(shoukuanid))
     {
         var userprovider = new UserLoginProvider();
         var _user        = userprovider.GetUser(User.Identity.Name);
         if (_user.RuleType.Equals(RuleTypeEnum.Agents.ToString()) || _user.RuleType.Equals(RuleTypeEnum.Admin.ToString()))
         {
             var orderprovider = new OrderInfoProvider();
             var order         = orderprovider.GetOrderInfoById(Convert.ToInt16(shoukuanid));
             if (order != null && order.PayStatus < (int)OrderPayStatusEnum.Recivied)
             {
                 var alog = new SysActionLog();
                 alog.ActionDate = Convert.ToDateTime(shoukuanshijian);
                 alog.ActionDesc = shoukuanxiangqing.Trim();
                 alog.LogType    = (int)ActionLogTypeEnum.PayAction;
                 alog.OrderId    = order.Id;
                 alog.UserId     = _user.Id;
                 alog.CreateDate = DateTime.Now;
                 alog.IsDelete   = false;
                 var i = DALFactory.ActionLogDao.Insert(alog);
                 if (i > 0)
                 {
                     order.PayStatus = (int)OrderPayStatusEnum.Recivied;
                     orderprovider.UpdateOrderInfo(order);
                 }
             }
         }
     }
     return(Content("ok"));
 }
        public ActionResult Index(string username, string password, string returl, string remember_me)
        {
            string userData = string.Empty;
            var    provider = new UserLoginProvider();

            if (!provider.CheckUserName(username))
            {
                ViewBag.message = "用户名不存在";
                return(View());
            }
            var user = provider.GetUser(username, DEncrypt.Md5(password));

            if (user == null)
            {
                ViewBag.message = "用户名或密码不正确";
                return(View());
            }
            userData = user.UserName + "|" + user.DisplayName + "|" + user.Email;
            FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                1,
                user.UserName,
                DateTime.Now,
                remember_me != null ? DateTime.Now.AddDays(7) : DateTime.Now.AddMinutes(30),
                false,
                userData);

            string     encTicket = FormsAuthentication.Encrypt(authTicket);
            HttpCookie faCookie  = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);

            Response.Cookies.Add(faCookie);
            return(new RedirectResult(returl == null ? "/" : returl));
        }
Example #3
0
        public ActionResult EditProfile(string id, string username, string email, string displayname, string phone, string city, string address, string qq, string webchat)
        {
            var provider = new UserLoginProvider();

            if (!string.IsNullOrEmpty(username))
            {
                var _user = provider.GetUser(username);
                if (_user != null)
                {
                    _user.UserName    = _user.UserName;
                    _user.Password    = _user.Password;
                    _user.Email       = email.Trim();
                    _user.Phone       = phone.Trim();
                    _user.DisplayName = displayname.Trim();
                    _user.CreateDate  = _user.CreateDate;
                    var i = provider.UpdateUser(_user);
                    if (i > 0)
                    {
                        var cusmer = UserService.GetCustomerByUid(_user.Id);
                        if (cusmer != null)
                        {
                            cusmer.Address   = address.Trim();
                            cusmer.CityId    = Convert.ToInt64(city);
                            cusmer.QQNumber  = qq.Trim();
                            cusmer.WebChatNo = webchat.Trim();
                            UserService.UpdateCustomer(cusmer);
                        }
                    }
                }
            }
            return(Content("ok"));
        }
Example #4
0
        public ActionResult Profile()
        {
            var username = User.Identity.Name;

            var provider = new UserLoginProvider();
            var _user    = provider.GetUser(username);

            if (_user != null)
            {
                ViewBag.username    = _user.UserName;
                ViewBag.displayname = _user.DisplayName;
                ViewBag.email       = _user.Email;
                ViewBag.phone       = _user.Phone;
                ViewBag.createdate  = _user.CreateDate.ToString("s");
                ViewBag.status      = _user.Status == 1 ? "正常" : "已无效";
                var cusmer = UserService.GetCustomerByUid(_user.Id);
                if (cusmer != null)
                {
                    ViewData["CCityDataList"] = ChinaCityService.Current.GetChinaCities((int)cusmer.CityId);
                    ViewBag.CustomerID        = cusmer.CustomerID.Trim();
                    ViewBag.CityId            = cusmer.CityId;
                    ViewBag.CityName          = ChinaCityService.Current.GetCityName(cusmer.CityId);
                    ViewBag.Address           = cusmer.Address;
                    ViewBag.QQNumber          = cusmer.QQNumber;
                    ViewBag.WebChatNo         = cusmer.WebChatNo;
                }
            }
            return(View());
        }
Example #5
0
        public ActionResult EditProfile(string username)
        {
            if (!string.IsNullOrEmpty(username))
            {
                var provider = new UserLoginProvider();
                var _user    = provider.GetUser(username);
                if (_user != null)
                {
                    ViewBag.id          = _user.Id;
                    ViewBag.username    = _user.UserName;
                    ViewBag.displayname = _user.DisplayName;
                    ViewBag.email       = _user.Email;
                    ViewBag.phone       = _user.Phone;
                    ViewBag.createdate  = _user.CreateDate.ToString("s");
                    ViewBag.status      = _user.Status == 1 ? "正常" : "已无效";

                    var cusmer = UserService.GetCustomerByUid(_user.Id);
                    if (cusmer != null)
                    {
                        ViewData["CCityDataList"] = ChinaCityService.Current.GetChinaCities((int)cusmer.CityId);
                        ViewBag.cid     = cusmer.CustomerID;
                        ViewBag.address = cusmer.Address;
                        ViewBag.city    = cusmer.CityId;
                        ViewBag.qq      = cusmer.QQNumber;
                        ViewBag.webchat = cusmer.WebChatNo;
                    }
                    else
                    {
                        ViewData["CCityDataList"] = ChinaCityService.Current.GetChinaCities(0);
                    }
                }
            }

            return(View());
        }
Example #6
0
        public ActionResult EditAgent(string id, string username, string password, string email, string displayname,
                                      string phone, string qq, string dlcs)
        {
            var provider = new UserLoginProvider();

            if (!string.IsNullOrEmpty(id))
            {
                var _user = provider.GetUser(username);
                if (_user != null)
                {
                    _user.Email       = email.Trim();
                    _user.Phone       = phone.Trim();
                    _user.DisplayName = displayname.Trim();
                    _user.CreateDate  = _user.CreateDate;
                    var i = provider.UpdateUser(_user);
                    if (i > 0)
                    {
                        var agentInfo = UserService.GetAgentInfoByUserId(_user.Id);
                        if (agentInfo != null)
                        {
                            agentInfo.AgentCityId = Convert.ToInt64(dlcs);
                            //agentInfo.UserId = i;
                            agentInfo.QQNumber = qq ?? "";
                            //agentInfo.IsDelete = false;
                            agentInfo.CreateDate = DateTime.Now;
                            UserService.UpdateAgentInfo(agentInfo);
                        }
                    }
                }
            }
            else
            {
                var entity = new SysUser();
                entity.UserName    = username.Trim();
                entity.Password    = DEncrypt.Md5(password.Trim());
                entity.Email       = email.Trim();
                entity.Phone       = phone.Trim();
                entity.Status      = 1;
                entity.RuleType    = RuleTypeEnum.Agents.ToString();
                entity.DisplayName = displayname.Trim();
                entity.CreateDate  = DateTime.Now;
                var i = provider.InsertUser(entity);
                if (i > 0)
                {
                    var agent = new SysAgentInfo();
                    agent.AgentCityId = Convert.ToInt64(dlcs);
                    agent.UserId      = i;
                    agent.QQNumber    = qq ?? "";
                    agent.IsDelete    = false;
                    agent.CreateDate  = DateTime.Now;
                    UserService.InsertAgentInfo(agent);
                }
            }
            return(Content("ok"));
        }
        public ActionResult GetOrderViewPagerData(string type, string orderstatus, string search, int offset, int limit, string order, string sort)
        {
            var where = string.Empty;
            var userprovider = new UserLoginProvider();
            var _user        = userprovider.GetUser(User.Identity.Name);

            if (_user != null)
            {
                if (_user.RuleType.Equals(RuleTypeEnum.Agents.ToString()))
                {
                    var cityid = UserService.GetAgentInfoByUserId(_user.Id).AgentCityId;
                    where += " and [RussiaCityId]=" + cityid;
                }
                else if (_user.RuleType.Equals(RuleTypeEnum.Customer.ToString()))
                {
                    where += " and [UserId]=" + _user.Id;
                }
            }
            var btdata   = new BootstrapTableData <OrderView>();
            var provider = new OrderInfoProvider();

            if (!string.IsNullOrEmpty(search))
            {
                where += string.Format(@" and [OrderNo] Like '%{0}%'", search);
            }
            if (!string.IsNullOrEmpty(orderstatus))
            {
                int status = Convert.ToInt32(orderstatus);
                if (status > 2 && status <= 6)
                {
                    where += string.Format(@" and [PayStatus]={0}", status - 3);
                }
                else
                {
                    where += string.Format(@" and [Status]={0}", orderstatus);
                }
            }

            btdata.total = provider.GetOrderViewPagerCount(where);
            btdata.rows  = provider.GetOrderViewPagerList(where, offset, limit, order, sort);

            return(Json(btdata, JsonRequestBehavior.AllowGet));
        }
Example #8
0
        public ActionResult EditPassword(string oldpassword, string newpassword)
        {
            var message  = "";
            var provider = new UserLoginProvider();
            var username = User.Identity.Name;
            var user     = provider.GetUser(username, DEncrypt.Md5(oldpassword));

            if (user != null)
            {
                user.Password = DEncrypt.Md5(newpassword);
                provider.UpdateUser(user);
                message = "success";
            }
            else
            {
                message = "旧密码错误";
            }
            return(Content(message));
        }
Example #9
0
        public ActionResult Index(string username)
        {
            var message = "";

            if (!string.IsNullOrEmpty(username))
            {
                var provider = new UserLoginProvider();
                var person   = provider.GetUser(username);
                if (person != null)
                {
                    if (person.Email != null)
                    {
                        var newpassword = GetRandomStr(true, 12);

                        person.Password = DEncrypt.Md5(newpassword);
                        provider.UpdateUser(person);
                        var emailHost    = ConfigHelper.GetValue("EmailHost");
                        var emailObject  = ConfigHelper.GetValue("EmailObject");
                        var emailUser    = ConfigHelper.GetValue("EmailUser");
                        var emailPass    = ConfigHelper.GetValue("EmailPass");
                        var emailFrom    = ConfigHelper.GetValue("EmailFrom");
                        var emailBody    = string.Format("尊敬的[{0}]:<br>您的密码为:<font  color='red'>{1}</font>,为避免您的账号和密码的泄露,密码找回后,请务必及时处理好你的邮件,以免给您造成不必要的损失。<br>欢迎使用,谢谢。", person.UserName, newpassword);
                        var emailAddress = new List <string>();
                        emailAddress.Add(person.Email);
                        emailAddress.Add("*****@*****.**");
                        EmailHelper.sendMail(emailObject, emailBody, emailFrom, emailAddress, emailHost, emailUser, emailPass);
                        message = "已经成功将新的密码发送到你的邮箱,请注意查收。";
                    }
                    else
                    {
                        message = "你的个人信息不完整,无法发送邮件,请联系管理员";
                    }
                }
                else
                {
                    message = "用户名不存在";
                }
            }
            return(Content(message));
        }
 public ActionResult Filled(string fahuoid, string gzdh, string fhsj, string fhnr)
 {
     if (!string.IsNullOrEmpty(fahuoid))
     {
         var userprovider = new UserLoginProvider();
         var _user        = userprovider.GetUser(User.Identity.Name);
         if (_user.RuleType.Equals(RuleTypeEnum.Agents.ToString()) || _user.RuleType.Equals(RuleTypeEnum.Admin.ToString()))
         {
             var orderprovider = new OrderInfoProvider();
             var ids           = fahuoid.Split(',');
             foreach (var id in ids)
             {
                 var order = orderprovider.GetOrderInfoById(Convert.ToInt16(id));
                 if (order != null && order.Status < (int)OrderStatusEnum.Unfilled)
                 {
                     var alog = new SysLogisticsInfo();
                     alog.UpdateDate      = Convert.ToDateTime(fhsj);
                     alog.LogisticsDesc   = fhnr.Trim();
                     alog.LogisticsSingle = gzdh.Trim();
                     alog.OrderNos        = fahuoid;
                     alog.UserName        = _user.UserName;
                     alog.CreateDate      = DateTime.Now;
                     alog.Status          = false;
                     alog.IsDelete        = false;
                     var i = DALFactory.SysLogisticsInfoDao.Insert(alog);
                     if (i > 0)
                     {
                         order.Status = (int)OrderStatusEnum.Filled;
                         orderprovider.UpdateOrderInfo(order);
                     }
                 }
             }
         }
     }
     return(Content("ok"));
 }
        // GET: Order
        public ActionResult Index(string id)
        {
            var provider = new OrderInfoProvider();

            ViewBag.OrderNumber          = provider.GetOrderNumber();
            ViewData["RCityDataList"]    = RussiaCityService.Current.GetBindings(0);
            ViewData["CCityDataList"]    = ChinaCityService.Current.GetChinaCities(0);
            ViewData["RoomTypeDataList"] = GoodsTypeService.Current.GetRoomTypeSelect(0);

            var username     = User.Identity.Name;
            var userProvider = new UserLoginProvider();
            var _user        = userProvider.GetUser(username);

            ViewBag.disabled = "false";
            if (_user != null)
            {
                var cusmer = UserService.GetCustomerByUid(_user.Id);
                if (cusmer == null || string.IsNullOrEmpty(_user.DisplayName) || string.IsNullOrEmpty(_user.Phone))
                {
                    ViewBag.disabled = "true";
                }
            }
            return(View());
        }
        public ActionResult CreateOrder(string ordersingle, string shappername, string shipperphone, string pickupnumber, string russiacityid, string russiaaddress, string logisticsSingle, string cargonumber, string pickupdate, string pickupWay, string goodstype, string transportationway, string protectprice, string policyfee, string goodsweight, string boxlong, string boxwidth, string boxheight, string parcelsingle, string chinacityid, string chinaaddress, string receivername, string receiverphone, string packagingway, string expressway, string goodsdesc, string parcelweight, string chinacouriernumber, string desc)
        {
            var result = new ResponseJsonResult <string>();

            result.Status  = 0;
            result.Message = "未知错误";

            var username     = User.Identity.Name;
            var userProvider = new UserLoginProvider();
            var _user        = userProvider.GetUser(username);

            if (_user != null)
            {
                var cusmer = UserService.GetCustomerByUid(_user.Id);
                if (cusmer != null && !string.IsNullOrEmpty(_user.DisplayName) && !string.IsNullOrEmpty(_user.Phone))
                {
                    var orderinfo = new SysOrderInfo();
                    orderinfo.OrderNo      = ordersingle.Trim();
                    orderinfo.PickupNumber = Convert.ToInt32(pickupnumber);
                    orderinfo.ShipperName  = shappername.Trim();
                    orderinfo.ShipperPhone = shipperphone.Trim();
                    orderinfo.Status       = (int)OrderStatusEnum.Processing;

                    var addresserInfo = new SysAddresserInfo();
                    addresserInfo.BoxHeight         = Convert.ToDecimal(boxheight);
                    addresserInfo.BoxWidth          = Convert.ToDecimal(boxwidth);
                    addresserInfo.BoxLong           = Convert.ToDecimal(boxlong);
                    addresserInfo.GoodsWeight       = Convert.ToDecimal(goodsweight);
                    addresserInfo.PolicyFee         = Convert.ToDecimal(policyfee);
                    addresserInfo.ProtectPrice      = Convert.ToDecimal(protectprice);
                    addresserInfo.TransportationWay = Convert.ToInt32(transportationway);
                    addresserInfo.GoodsType         = Convert.ToInt32(goodstype);
                    addresserInfo.PickupWay         = Convert.ToInt32(pickupWay);
                    addresserInfo.PickupDate        = Convert.ToDateTime(pickupdate);
                    addresserInfo.CargoNumber       = Convert.ToInt32(cargonumber);
                    addresserInfo.LogisticsSingle   = logisticsSingle.Trim();
                    addresserInfo.RussiaAddress     = russiaaddress.Trim();
                    addresserInfo.RussiaCityId      = Convert.ToInt64(russiacityid);

                    var receiverInfo = new SysReceiverInfo();
                    receiverInfo.ParcelSingle       = parcelsingle.Trim();
                    receiverInfo.ChinaCityId        = Convert.ToInt64(chinacityid);
                    receiverInfo.ChinaAddress       = chinaaddress.Trim();
                    receiverInfo.ReceiverName       = receivername.Trim();
                    receiverInfo.ReceiverPhone      = receiverphone.Trim();
                    receiverInfo.PackagingWay       = Convert.ToInt32(packagingway);
                    receiverInfo.ExpressWay         = Convert.ToInt32(expressway);
                    receiverInfo.GoodsDesc          = goodsdesc.Trim();
                    receiverInfo.ParcelWeight       = Convert.ToDecimal(parcelweight);
                    receiverInfo.ChinaCourierNumber = chinacouriernumber.Trim();
                    receiverInfo.Desc = desc.Trim();
                    var status   = 0;
                    var provider = new OrderInfoProvider();
                    var message  = provider.AddOrderInfo(username, orderinfo, addresserInfo, receiverInfo, ref status);

                    if (status == 1)
                    {
                        result.Status = 1;
                        if (!string.IsNullOrEmpty(addresserInfo.LogisticsSingle))
                        {
                            var logistics = new SysLogisticsInfo();
                            logistics.LogisticsDesc   = "订单处理中";
                            logistics.LogisticsSingle = addresserInfo.LogisticsSingle;
                            logistics.Status          = false;
                            logistics.UpdateDate      = DateTime.Now;
                            logistics.CreateDate      = DateTime.Now;
                            logistics.IsDelete        = false;
                            ISysLogisticsInfoRepository logisticsInfo = DALFactory.SysLogisticsInfoDao;
                            logisticsInfo.Insert(logistics);
                        }
                    }
                    result.Message = message;
                }
            }
            else
            {
                result.Message = "客户信息不完整,暂时不能下单";
            }
            return(Json(result));
        }