public SQSService()
            {
                try
                {
                    ServiceName = Program.ServiceName;


                    nLogger.Log(LogLevel.Info, "AppSettings Initializing");

                    var appSettings = ConfigurationManager.AppSettings;

                    nLogger.Log(LogLevel.Info, "AppSettings Initialized");

                    sellerInfo                        = new SellerInfo();
                    sellerInfo.QueueUrl               = appSettings["queueUrl"];
                    sellerInfo.SqsServiceUrl          = appSettings["sqsServiceUrl"];
                    sellerInfo.MwsServiceUrl          = appSettings["mwsServiceUrl"];
                    sellerInfo.MwsAuthToken           = appSettings["mwsAuthToken"];
                    sellerInfo.UpdatePrices           = bool.Parse(appSettings["updatePrices"]);
                    sellerInfo.BatchSize              = int.Parse(appSettings["batchSize"]);
                    sellerInfo.BatchWaitTimeSec       = int.Parse(appSettings["batchWaitTimeSec"]);
                    sellerInfo.FeedSize               = int.Parse(appSettings["feedSize"]);
                    sellerInfo.BetweenFeedWaitTimeSec = int.Parse(appSettings["betweenFeedWaitTimeSec"]);



                    consumer = new SQSConsumer(sellerInfo, nLogger, dataRepository);
                }
                catch (Exception ex)
                {
                    nLogger.Log(LogLevel.Error, ex);
                    Stop();
                }
            }
Exemple #2
0
        public async Task <Unit> Handle(AddSellerCommand request, CancellationToken cancellationToken)
        {
            var userInfo = await _ebayService.GetUser(request.UserName);

            if (userInfo != null)
            {
                var seller = new SellerInfo
                {
                    EmailAddress       = userInfo.Email?.Contains("@") ?? false ? userInfo.Email : null,
                    EbaySellerUserName = userInfo.UserName.ToLower(),
                    Address1           = userInfo.Street,
                    Address2           = userInfo.Street1,
                    Address3           = userInfo.Street2,
                    City            = userInfo.City,
                    State           = userInfo.State,
                    Zip             = userInfo.Zip,
                    DateAdded       = userInfo.RegistrationDate,
                    FirstName       = userInfo.FirstName,
                    LastName        = userInfo.LastName,
                    LastProcessDate = DateTime.UtcNow,
                };
                _sellerRepo.Add(seller);
                await _uow.SaveEntitiesAsync();
            }
            return(Unit.Value);
        }
    public List <SellerInfo> SelectByParentSellerID(SellerInfo sellerInfo)
    {
        string        SQLServerConnectString = "Data Source=localhost;Initial Catalog=WebAPPDevDotNETFinnalTest;Integrated Security=True;Pooling=False";
        SqlConnection SQLConnection          = new SqlConnection(SQLServerConnectString);
        string        SQLCommandText         = "SELECT * FROM [dbo].[SellerInfo] WHERE ParentSellerID=@ParentSellerID";
        SqlCommand    SQLCommand             = new SqlCommand(SQLCommandText, SQLConnection);

        SQLCommand.Parameters.Add(new SqlParameter("@ParentSellerID", sellerInfo.ParentSellerID));

        DataSet        dataSet        = new DataSet();
        SqlDataAdapter SQLDataAdapter = new SqlDataAdapter(SQLCommand);

        SQLConnection.Open();
        SQLDataAdapter.Fill(dataSet);
        SQLConnection.Close();

        List <SellerInfo> SelectResult = new List <SellerInfo>();

        for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
        {
            SellerInfo temp = new SellerInfo();
            temp.SellerID       = Int32.Parse(dataSet.Tables[0].Rows[i]["SellerID"].ToString());
            temp.ParentSellerID = Int32.Parse(dataSet.Tables[0].Rows[i]["ParentSellerID"].ToString());
            temp.Level          = dataSet.Tables[0].Rows[i]["Level"].ToString();
            temp.Phone          = dataSet.Tables[0].Rows[i]["Phone"].ToString();
            temp.Name           = dataSet.Tables[0].Rows[i]["Name"].ToString();
            temp.Provience      = dataSet.Tables[0].Rows[i]["Provience"].ToString();
            temp.City           = dataSet.Tables[0].Rows[i]["City"].ToString();
            temp.Address        = dataSet.Tables[0].Rows[i]["Address"].ToString();
            SelectResult.Add(temp);
        }
        return(SelectResult);
    }
    public SellerInfo SelectOne(SellerInfo sellerInfo)
    {
        string        SQLServerConnectString = "Data Source=localhost;Initial Catalog=WebAPPDevDotNETFinnalTest;Integrated Security=True;Pooling=False";
        SqlConnection SQLConnection          = new SqlConnection(SQLServerConnectString);
        string        SQLCommandText         = "SELECT * FROM [dbo].[SellerInfo] WHERE SellerID=@SellerID";
        SqlCommand    SQLCommand             = new SqlCommand(SQLCommandText, SQLConnection);

        SQLCommand.Parameters.Add(new SqlParameter("@SellerID", sellerInfo.SellerID));

        DataSet        dataSet        = new DataSet();
        SqlDataAdapter SQLDataAdapter = new SqlDataAdapter(SQLCommand);

        SQLConnection.Open();
        SQLDataAdapter.Fill(dataSet);
        SQLConnection.Close();

        SellerInfo SelectResult = new SellerInfo();

        if (dataSet.Tables[0].Rows.Count == 0)
        {
            return(null);
        }
        SelectResult.SellerID       = Int32.Parse(dataSet.Tables[0].Rows[0]["SellerID"].ToString());
        SelectResult.ParentSellerID = Int32.Parse(dataSet.Tables[0].Rows[0]["ParentSellerID"].ToString());
        SelectResult.Level          = dataSet.Tables[0].Rows[0]["Level"].ToString();
        SelectResult.Phone          = dataSet.Tables[0].Rows[0]["Phone"].ToString();
        SelectResult.Name           = dataSet.Tables[0].Rows[0]["Name"].ToString();
        SelectResult.Provience      = dataSet.Tables[0].Rows[0]["Provience"].ToString();
        SelectResult.City           = dataSet.Tables[0].Rows[0]["City"].ToString();
        SelectResult.Address        = dataSet.Tables[0].Rows[0]["Address"].ToString();
        return(SelectResult);
    }
Exemple #5
0
        public ActionResult MainView()
        {
            var user = GetUser();

            string msg;
            var    list = BuyerInfoBll.GetSellerList(user.BuyerId, out msg);

            if (list != null)
            {
                if (list.Count == 0)
                {
                    return(RedirectToAction("NoSeller"));
                }
                if (list.Count == 1)
                {
                    SellerInfo sellerInfo = list.FirstOrDefault();
                    if (sellerInfo != null)
                    {
                        return(RedirectToAction("ShowSellersGoods", new { sellerId = sellerInfo.SellerId }));
                    }
                }
            }

            return(View(user));
        }
Exemple #6
0
        /// <summary>
        /// 登录页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Login()
        {
            string name = string.Empty;
            string pwd  = string.Empty;

            if (!string.IsNullOrEmpty(Request.Form["name"]))
            {
                name = Request.Form["name"];
            }
            if (!string.IsNullOrEmpty(Request.Form["name"]))
            {
                pwd = Request.Form["pwd"];
            }
            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(pwd))
            {
                string     error = string.Empty;
                SellerInfo model = new SellerInfo();
                SellerInfoBll.RequestLogin(name, pwd, out model, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    Response.Write("<script>alert('" + error + "');</script>");
                    //Response.Redirect("/UserCenter/Login");
                }
                else
                {
                    HttpCookie cookie = new HttpCookie("userId");
                    cookie.Value   = model.SellerId.ToString();
                    cookie.Expires = DateTime.Now.AddDays(1);
                    Response.Cookies.Add(cookie);
                    Session["UserId"] = model.SellerId;
                    Response.Redirect("/BackStage/Index");
                }
            }
            return(View());
        }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex == GridView1.EditIndex && e.Row.RowIndex != -1)
        {
            (e.Row.FindControl("DropDownListLevel") as DropDownList).Text = (e.Row.FindControl("TextBoxLevel") as TextBox).Text;

            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataTextField  = "Name";
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataValueField = "SellerID";
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataSource     = (new BLL_SellerInfo()).SelectAll(true);
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataBind();
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).Text = (e.Row.FindControl("TextBoxParentSellerID") as TextBox).Text;
        }
        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataTextField  = "Name";
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataValueField = "SellerID";
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataSource     = (new BLL_SellerInfo()).SelectAll(true);
            (e.Row.FindControl("DropDownListParentSellerID") as DropDownList).DataBind();
        }
        if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == -1)
        {
            SellerInfo temp = (new BLL_SellerInfo()).SelectOne(Int32.Parse((e.Row.FindControl("LabelParentSellerID") as Label).Text));
            if (temp != null)
            {
                (e.Row.FindControl("LabelParentSellerID") as Label).Text = temp.Name;
            }
            else
            {
                (e.Row.FindControl("LabelParentSellerID") as Label).Text = "SellerID:" + (e.Row.FindControl("LabelParentSellerID") as Label).Text;
            }
        }
    }
Exemple #8
0
 protected SellerInfo sInfo = null; // 商家
 protected void bind()
 {
     if (id <= 0)
     {
         Response.Write("<script>alert('参数错误');history.go(-1);</script>");
         Response.End();
     }
     info = BLL.goodsBLL.GetModel(id);
     if (info == null || info.GoodsId != id)
     {
         Response.Write("<script>alert('无对应的商品');history.go(-1);</script>");
         Response.End();
     }
     name = info.GoodsName;
     if (info.sellerid <= 0)
     {
         Response.Write("<script>alert('无对应的商家信息');history.go(-1);</script>");
         Response.End();
     }
     sInfo = BLL.SellerBLL.GetModel(info.sellerid);
     if (sInfo == null || sInfo.sellerid != info.sellerid)
     {
         Response.Write("<script>alert('无对应的商家信息');history.go(-1);</script>");
         Response.End();
     }
 }
Exemple #9
0
        public ActionResult Create(ProductListViewModel listproductObj)
        {
            //ProductListViewModel listproductObj = new ProductListViewModel();
            Product            productObj = new Product();
            var                fileName   = String.Empty;
            List <ProductGrid> gridInfo   = new List <ProductGrid>();

            try
            {
                // null chr=eck
                if (listproductObj.productImage != null && listproductObj.productImage.ContentLength > 0)
                {
                    //var fileName = Path.GetFileName(file.FileName);
                    fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(listproductObj.productImage.FileName);
                    var uploadUrl = Server.MapPath("~/Upload");
                    listproductObj.productImage.SaveAs(Path.Combine(uploadUrl, fileName));
                }

                // todo - check existing product

                productObj.ProductName = listproductObj.ProductName;
                //var CheckProductName = dbOBJ.ProductsTable.Where(x => x.ProductName == productObj.ProductName).FirstOrDefault();
                if (dbOBJ.ProductsTable.Any(x => x.ProductName == productObj.ProductName))
                {
                    return(View("ExistingProductInfo"));
                }
                else
                {
                    productObj.CashOnDelevery = listproductObj.CashOnDelevery;
                    int catId = Convert.ToInt32(listproductObj.SelectedCategory);
                    productObj.Category  = dbOBJ.CatagoriesTable.Where(x => x.CategoryID == catId).FirstOrDefault();
                    productObj.Price     = listproductObj.Price;
                    productObj.ImagePath = fileName;
                    Product product = dbOBJ.ProductsTable.Add(productObj);

                    foreach (var sellerId in listproductObj.SelectedSellers)
                    {
                        SellerInfo sellerInfoObj = new SellerInfo();
                        sellerInfoObj.Seller  = dbOBJ.SellerTable.Where(x => x.SellerID == sellerId).FirstOrDefault();
                        sellerInfoObj.Product = product;
                        dbOBJ.sellerInfoTable.Add(sellerInfoObj);
                    }

                    dbOBJ.SaveChanges();

                    listproductObj.CatagoryList = GetCategories();
                    listproductObj.SellerList   = GetSellers();

                    //listproductObj.gridinfo = GetGridData();

                    gridInfo = GetGridData();
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Data svaed Failure";
            }
            return(View("ProductGrid", gridInfo));
        }
Exemple #10
0
    public void Delete(int SellerID)
    {
        SellerInfo sellerInfo = new SellerInfo();

        sellerInfo.SellerID = SellerID;
        DAL_SellerInfo SellerInfoDAL = new DAL_SellerInfo();

        SellerInfoDAL.Delete(sellerInfo);
    }
Exemple #11
0
    public List <SellerInfo> SelectByParentSellerID(int ParentSellerID)
    {
        SellerInfo sellerInfo = new SellerInfo();

        sellerInfo.ParentSellerID = ParentSellerID;
        DAL_SellerInfo SellerInfoDAL = new DAL_SellerInfo();

        return(SellerInfoDAL.SelectByParentSellerID(sellerInfo));
    }
Exemple #12
0
    public SellerInfo SelectOne(int SellerID)
    {
        SellerInfo sellerInfo = new SellerInfo();

        sellerInfo.SellerID = SellerID;
        DAL_SellerInfo SellerInfoDAL = new DAL_SellerInfo();

        return(SellerInfoDAL.SelectOne(sellerInfo));
    }
Exemple #13
0
        public async Task <ActionResult> SellerRegister(SellerRegisterViewModel model, HttpPostedFileBase FrontImage, HttpPostedFileBase BackImage)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, FirstName = model.Fname, LastName = model.Lname, PhoneNumber = model.PhoneNo
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var newseller = new SellerInfo()
                    {
                        ID = user.Id, NationalID = model.NationalID, BusinessName = model.BusinessName,
                    };
                    db.SellerInfo.Add(newseller);
                    db.SaveChanges();

                    await UserManager.AddToRoleAsync(user.Id, "seller");

                    string newimg = user.Id.ToString() + "." + FrontImage.FileName.Split('.')[1];

                    FrontImage.SaveAs(Server.MapPath("~/SellerInfoImgs/") + newimg);
                    newseller.FrontImage = newimg;

                    string new2img = user.Id.ToString() + "." + BackImage.FileName.Split('.')[1];

                    BackImage.SaveAs(Server.MapPath("~/SellerInfoImgs/") + new2img);
                    newseller.BackImage = new2img;

                    db.SaveChanges();
                    var newInventory = new Inventory()
                    {
                        ID = newseller.ID, BuildingNum = model.BuildingNum, Street = model.Street, City = model.City, LandLineNum = model.LandLineNum
                    };
                    db.Inventories.Add(newInventory);
                    db.SaveChanges();



                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("InventoryManagement", "Seller"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View("sellerRegister", model));
        }
        public async Task <IActionResult> Post([FromBody] SellerInfo seller)
        {
            if ((int)this.userRepo.ExecuteOperation("ExistsLogin", new[] { new KeyValuePair <string, object>("login", seller.Login) }) == 1)
            {
                throw new System.Exception("Username already exists");
            }
            var res = await this.repo.ExecuteOperationAsync("CreateSeller", new[] { new KeyValuePair <string, object>("name", seller.Name), new KeyValuePair <string, object>("email", seller.Email), new KeyValuePair <string, object>("cellphone", seller.CellPhone), new KeyValuePair <string, object>("address", seller.Address), new KeyValuePair <string, object>("login", seller.Login), new KeyValuePair <string, object>("password", MyCryptography.Encrypt(seller.Password)) });

            return(Ok(res));
        }
Exemple #15
0
        public string GetSellerUserInfo()
        {
            string     errMsg = string.Empty;
            SellerInfo model  = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);

            if (model != null)
            {
                model.MobilePhone = model.MobilePhone.Substring(0, 3) + "****" + model.MobilePhone.Substring(model.MobilePhone.Length - 4, 4);
            }
            return(JsonConvert.SerializeObject(model));
        }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        SellerInfo temp = (new BLL_SellerInfo()).SelectOne(Int32.Parse((GridView1.SelectedRow.FindControl("LabelSellerID") as Label).Text));

        ChoosedSellerID       = temp.SellerID;
        GridView2.Caption     = "经销商 " + temp.Name + " 的用户";
        GridView2.ShowFooter  = false;
        GridView2.EditIndex   = -1;
        ButtonInsert2.Visible = true;
        GridView2_FetchData();
    }
        public async Task <IActionResult> Put(int id, [FromBody] SellerInfo seller)
        {
            var userId = GetCurrentUserId();

            if (userId == ((SellerInfo)(await this.repo.ExecuteOperationAsync("GetSeller", new[] { new KeyValuePair <string, object>("id", id) }))).UserId)
            {
                await this.repo.ExecuteOperationAsync("UpdateSeller", new[] { new KeyValuePair <string, object>("id", id), new KeyValuePair <string, object>("name", seller.Name ?? DBNull.Value.ToString()), new KeyValuePair <string, object>("cellphone", seller.CellPhone ?? DBNull.Value.ToString()), new KeyValuePair <string, object>("address", seller.Address ?? DBNull.Value.ToString()), new KeyValuePair <string, object>("email", seller.Email ?? DBNull.Value.ToString()), new KeyValuePair <string, object>("password", MyCryptography.Encrypt(seller.Password) ?? DBNull.Value.ToString()) });

                return(await this.GetById(id));
            }
            return(NotFound());
        }
    public void Delete(SellerInfo sellerInfo)
    {
        string        SQLServerConnectString = "Data Source=localhost;Initial Catalog=WebAPPDevDotNETFinnalTest;Integrated Security=True;Pooling=False";
        SqlConnection SQLConnection          = new SqlConnection(SQLServerConnectString);
        string        SQLCommandText         = "DELETE [dbo].[SellerInfo] where [SellerID] = @SellerID";
        SqlCommand    SQLCommand             = new SqlCommand(SQLCommandText, SQLConnection);

        SQLCommand.Parameters.Add(new SqlParameter("@SellerID", sellerInfo.SellerID));
        SQLConnection.Open();
        SQLCommand.ExecuteNonQuery();
        SQLConnection.Close();
    }
Exemple #19
0
 protected override void OnLoad(EventArgs e)
 {
     sellerinfo = getsellerinfo(sellerid);
     if (sellerinfo == null || sellerid <= 0)
     {
         Response.Write("<script language='javascript'>window.location.href = '/seller/login.html?fromurl=" + HttpContext.Current.Request.Url.AbsoluteUri + "';</script>");
         Response.End();
     }
     uname = sellerinfo.uname;
     name  = sellerinfo.name;
     base.OnLoad(e);
 }
Exemple #20
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            SellerUser temp1 = (new BLL_SellerUser()).SelectOne(Int32.Parse(e.Row.Cells[1].Text));
            if (temp1 != null)
            {
                e.Row.Cells[1].Text = temp1.UserName;
            }
            else
            {
                e.Row.Cells[1].Text = "UserID:" + e.Row.Cells[1].Text;
            }
            Model temp2 = (new BLL_Model()).SelectOne(Int32.Parse(e.Row.Cells[3].Text));
            if (temp2 != null)
            {
                e.Row.Cells[3].Text = temp2.ModelName;
            }
            else
            {
                e.Row.Cells[3].Text = "ModelID:" + e.Row.Cells[3].Text;
            }

            Brand temp4 = (new BLL_Brand()).SelectOne(temp2.BrandID);
            if (temp4 != null)
            {
                e.Row.Cells[2].Text = temp4.BrandName;
            }
            else
            {
                e.Row.Cells[2].Text = "BrandID:" + temp2.BrandID;
            }

            if (Int32.Parse(e.Row.Cells[6].Text) == -1)
            {
                e.Row.Cells[6].Text = "-";
            }
            else
            {
                SellerInfo temp3 = (new BLL_SellerInfo()).SelectOne(Int32.Parse(e.Row.Cells[6].Text));
                if (temp3 != null)
                {
                    e.Row.Cells[6].Text = temp3.Name;
                }
                else
                {
                    e.Row.Cells[6].Text = "SellerID:" + e.Row.Cells[6].Text;
                }
            }
        }
    }
Exemple #21
0
 public SellerInfo getsellerinfo(int sellerid)
 {
     //memberInfo Entity = memberBLL.memberEntity;
     //if (Entity != null && Entity.uid.Trim().Length > 0)
     //{
     //    return Entity;
     //}
     if (sellerid > 0)
     {
         SellerInfo Entity = BLL.SellerBLL.GetModel(sellerid);
         return(Entity);
     }
     return(null);
 }
Exemple #22
0
    public void New(string Name, string Provience, string City, string Address, string Phone, int ParentSellerID, string Level)
    {
        SellerInfo sellerInfo = new SellerInfo();

        sellerInfo.Name           = Name;
        sellerInfo.Provience      = Provience;
        sellerInfo.City           = City;
        sellerInfo.Address        = Address;
        sellerInfo.Phone          = Phone;
        sellerInfo.ParentSellerID = ParentSellerID;
        sellerInfo.Level          = Level;
        DAL_SellerInfo SellerInfoDAL = new DAL_SellerInfo();

        SellerInfoDAL.Insert(sellerInfo);
    }
Exemple #23
0
        static void Main(string[] args)
        {
            Adress adress = new Adress
            {
                City             = "Sofia",
                StreetNameNumber = "Vidin",
                Postcode         = "M204AL",
            };

            SellerInfo sellerInfo = new SellerInfo
            {
                SellerAge  = 30,
                SellerName = "Ivan",
            };

            SellerExp sellerExp = new SellerExp
            {
                DaysCount   = 24,
                MonthsCount = 12,
                YearsCount  = 4,
            };

            // Creating a List of Products
            List <Product> Products = new List <Product>
            {
                new Product
                {
                    ProductName   = "Bear",
                    ProductPrice  = 22.30M,
                    ProductWeight = 333.21,
                    ExpDate       = new DateTime(2026, 3, 1, 7, 0, 0)
                },
                new Product
                {
                    ProductName   = "Dino",
                    ProductPrice  = 12.55M,
                    ProductWeight = 310.52,
                    ExpDate       = new DateTime(2022, 5, 5, 1, 0, 0)
                }
            };

            Console.WriteLine("Here you can buy:");
            Console.WriteLine(Products[1].ProductName);
            Console.WriteLine("For the price of:");
            Console.WriteLine(Products[1].ProductPrice);
            Console.WriteLine("From our Seller: ");
            Console.WriteLine(sellerInfo.SellerName);
        }
Exemple #24
0
        public static SellerInfoDto ToDto(this SellerInfo sellerInfo)
        {
            if (sellerInfo == null)
            {
                return(null);
            }

            return(new SellerInfoDto
            {
                Id = sellerInfo.Id,
                BankAccountNumber = sellerInfo.BankAccountNumber,
                ContactEmail = sellerInfo.ContactEmail,
                PhoneNumber = sellerInfo.PhoneNumber,
                AdditionalInfo = sellerInfo.AdditionalInfo
            });
        }
Exemple #25
0
        /// <summary>
        /// 修改密码保存
        /// </summary>
        /// <returns></returns>
        public string ChangePwd()
        {
            string newValue = string.Empty;
            string oldValue = string.Empty;

            if (!string.IsNullOrEmpty(Request.Form["oldPwd"]))
            {
                oldValue = Request.Form["oldPwd"];
            }
            if (!string.IsNullOrEmpty(Request.Form["newPwd"]))
            {
                newValue = Request.Form["newPwd"];
            }
            if (!string.IsNullOrEmpty(oldValue) && !string.IsNullOrEmpty(newValue))
            {
                string     errMsg = string.Empty;
                SellerInfo model  = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);
                if (model != null)
                {
                    if (model.Password == oldValue)
                    {
                        model.Password = newValue;
                        if (SellerInfoBll.Update(model))
                        {
                            return("修改成功");
                        }
                        else
                        {
                            return("修改失败");
                        }
                    }
                    else
                    {
                        return("原密码不正确");
                    }
                }
                else
                {
                    return("请重新登录后操作");
                }
            }
            else
            {
                return("参数信息出错,请重试");
            }
        }
Exemple #26
0
        public IActionResult GetAllInformation(PersonalCenter info)
        {
            DBHelper dBHelper = new DBHelper();

            try
            {
                if (info.UserType == "CUSTOMER")
                {
                    UserInfo  res   = new UserInfo();
                    string    Sql   = @"SELECT ID,USER_NAME,ADDRESS,DATE_OF_REG,PHONE_NUMBER,PHOTO
                                FROM CUSTOMER
                                WHERE ID =" + info.ID;
                    DataTable table = dBHelper.ExecuteTable(Sql);
                    DataRow   row   = table.Rows[0];
                    res.ID          = row["ID"].ToString();
                    res.UserName    = row["USER_NAME"].ToString();
                    res.Address     = row["ADDRESS"].ToString();
                    res.RegDate     = row["DATE_OF_REG"].ToString();
                    res.PhoneNumber = row["PHONE_NUMBER"].ToString();
                    res.Image       = dBHelper.GetCustomerBlob(info.ID);
                    return(Ok(dBHelper.ToJson(res)));
                }
                else if (info.UserType == "SELLER")
                {
                    SellerInfo res   = new SellerInfo();
                    string     Sql   = @"SELECT ID,SELLER_NAME,ADDRESS,DATE_OF_REG,PHONE_NUMBER,EARNING,PHOTO
                                FROM SELLER
                                WHERE ID =" + info.ID;
                    DataTable  table = dBHelper.ExecuteTable(Sql);
                    DataRow    row   = table.Rows[0];
                    res.ID          = row["ID"].ToString();
                    res.SellerName  = row["SELLER_NAME"].ToString();
                    res.Address     = row["ADDRESS"].ToString();
                    res.RegDate     = row["DATE_OF_REG"].ToString();
                    res.Income      = double.Parse(row["EARNING"].ToString());
                    res.Image       = dBHelper.GetSellerBlob(info.ID);
                    res.PhoneNumber = row["PHONE_NUMBER"].ToString();
                    return(Ok(dBHelper.ToJson(res)));
                }
                return(BadRequest("未知的错误发生了"));
            }
            catch (OracleException)
            {
                return(BadRequest("数据库请求错误"));
            }
        }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        SellerInfo sellerInfo = new SellerInfo();

        sellerInfo.SellerID       = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("LabelSellerID") as Label).Text);
        sellerInfo.Name           = (GridView1.Rows[e.RowIndex].FindControl("TextBoxName") as TextBox).Text;
        sellerInfo.Provience      = (GridView1.Rows[e.RowIndex].FindControl("TextBoxProvience") as TextBox).Text;
        sellerInfo.City           = (GridView1.Rows[e.RowIndex].FindControl("TextBoxCity") as TextBox).Text;
        sellerInfo.Phone          = (GridView1.Rows[e.RowIndex].FindControl("TextBoxPhone") as TextBox).Text;
        sellerInfo.Address        = (GridView1.Rows[e.RowIndex].FindControl("TextBoxAddress") as TextBox).Text;
        sellerInfo.Level          = (GridView1.Rows[e.RowIndex].FindControl("DropDownListLevel") as DropDownList).Text;
        sellerInfo.ParentSellerID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("DropDownListParentSellerID") as DropDownList).Text);
        (new BLL_SellerInfo()).Update(sellerInfo.SellerID, sellerInfo.Name, sellerInfo.Provience, sellerInfo.City, sellerInfo.Address, sellerInfo.Phone, sellerInfo.ParentSellerID, sellerInfo.Level);

        GridView1.EditIndex = -1;
        GridView1_FetchData();
    }
Exemple #28
0
 // GET: BackStage
 public ActionResult Index()
 {
     ViewBag.menu = GetMenuList();
     //ViewBag.UserName = "******";
     if (Request.Cookies["userId"] != null && !string.IsNullOrEmpty(Request.Cookies["userId"].Value))
     {
         string     errMsg = string.Empty;
         SellerInfo model  = SellerInfoBll.GetModel(int.Parse(Request.Cookies["userId"].Value), out errMsg);
         ViewBag.UserName = model.CompanyName;
         //ViewBag.phone = model.MobilePhone.Substring(0,3)+"****"+model.MobilePhone.Substring(model.MobilePhone.Length-4,4);
     }
     else
     {
         Response.Redirect("/UserCenter/Login");
     }
     return(View());
 }
        public async Task <Unit> Handle(CreateOrUpdateSellerInfoCommand request, CancellationToken cancellationToken)
        {
            var userId     = _httpContext.User.Claims.ToTokenPayload().UserClaims.Id;
            var sellerInfo = await _sellerInfoRepository.GetByUserIdAsync(userId);

            var sellerInfoExists = sellerInfo != null;

            if (!sellerInfoExists)
            {
                sellerInfo = new SellerInfo(userId, request.ContactEmail, request.PhoneNumber, request.BankAccountNumber);
                if (request.AdditionalInfo != null)
                {
                    sellerInfo.SetAdditionalInfo(request.AdditionalInfo);
                }
                _sellerInfoRepository.Add(sellerInfo);
            }
            else
            {
                if (request.ContactEmail != null)
                {
                    sellerInfo.SetContactEmail(request.ContactEmail);
                }
                if (request.PhoneNumber != null)
                {
                    sellerInfo.SetPhoneNumber(request.PhoneNumber);
                }
                if (request.BankAccountNumber != null)
                {
                    sellerInfo.SetBankAccountNumber(request.BankAccountNumber);
                }
                if (request.AdditionalInfo != null)
                {
                    sellerInfo.SetAdditionalInfo(request.AdditionalInfo);
                }
            }

            if (sellerInfoExists)
            {
                _sellerInfoRepository.Update(sellerInfo);
            }

            await _sellerInfoRepository.UnitOfWork.SaveChangesAndDispatchDomainEventsAsync(cancellationToken);

            return(await Unit.Task);
        }
    public void Insert(SellerInfo sellerInfo)
    {
        string        SQLServerConnectString = "Data Source=localhost;Initial Catalog=WebAPPDevDotNETFinnalTest;Integrated Security=True;Pooling=False";
        SqlConnection SQLConnection          = new SqlConnection(SQLServerConnectString);
        string        SQLCommandText         = "INSERT INTO [dbo].[SellerInfo] ([Phone], [Provience], [City], [Address], [Name], [Level], [ParentSellerID]) VALUES (@Phone, @Provience, @City, @Address, @Name, @Level, @ParentSellerID)";
        SqlCommand    SQLCommand             = new SqlCommand(SQLCommandText, SQLConnection);

        SQLCommand.Parameters.Add(new SqlParameter("@Phone", sellerInfo.Phone));
        SQLCommand.Parameters.Add(new SqlParameter("@Provience", sellerInfo.Provience));
        SQLCommand.Parameters.Add(new SqlParameter("@City", sellerInfo.City));
        SQLCommand.Parameters.Add(new SqlParameter("@Address", sellerInfo.Address));
        SQLCommand.Parameters.Add(new SqlParameter("@Name", sellerInfo.Name));
        SQLCommand.Parameters.Add(new SqlParameter("@Level", sellerInfo.Level));
        SQLCommand.Parameters.Add(new SqlParameter("@ParentSellerID", sellerInfo.ParentSellerID));
        SQLConnection.Open();
        SQLCommand.ExecuteNonQuery();
        SQLConnection.Close();
    }