Beispiel #1
0
 /// <summary>
 /// Verifies the exists.
 /// </summary>
 private void VerifyExists()
 {
     if (!Buyers.Exists(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerDob, _buyerDLic, out _errOut))
     {
         bool value = Buyers.Add(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerPhone, _buyerCountry, _buyerEMail, _buyerLic, _buyerWebSite, _buyerFax, _buyerDob, _buyerDLic, _buyerResident, out _errOut);
     }
 }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Address")] Buyers buyers)
        {
            if (id != buyers.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(buyers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuyersExists(buyers.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(buyers));
        }
Beispiel #3
0
        public List <SysArticleChallan> GetSearchInformation()
        {
            using (_context)
            {
                var Data = (from c in _context.Sys_ArticleChallan.AsEnumerable()

                            join b in _context.Sys_Buyer on c.BuyerID equals b.BuyerID into Buyers
                            from b in Buyers.DefaultIfEmpty()

                            join a in _context.Sys_Article on c.ArticleID equals a.ArticleID into Articles
                            from a in Articles.DefaultIfEmpty()

                            orderby c.ArticleChallanID descending
                            select new SysArticleChallan
                {
                    ArticleChallanID = c.ArticleChallanID,
                    ArticleChallanNo = c.ArticleChallanNo,
                    BuyerID = c.BuyerID,
                    BuyerCode = (b == null?null:b.BuyerCode),
                    BuyerName = (b == null ? null : b.BuyerName),
                    ArticleID = c.ArticleID,
                    ArticleName = (a == null?null:a.ArticleName),
                    PreparationDate = Convert.ToDateTime(c.PreparationDate).ToString("dd'/'MM'/'yyyy"),
                    RecordStatus = DalCommon.ReturnRecordStatus(c.RecordStatus),
                    ChallanNote = c.ChallanNote,
                    ArticleNote = c.ArticleNote,
                    ArticleArea = c.ArticleArea
                }).ToList();

                return(Data);
            }
        }
Beispiel #4
0
        public static bool UpdateForHistory(Buyers o)
        {
            try
            {
                string query = @"update Buyer 
                                set buyer_reallName = @buyer_reallName,
                                cellPhone = @cellPhone,                           
                                province = @province,
                                buyer_credit = @buyer_credit,
                                address = @address,
                                updateDate = getdate()                               
                                WHERE buyer_nick = @buyer_nick and SELLER_ID = @SELLER_ID";

                SqlParameter[] param = new SqlParameter[]
                {
                    new SqlParameter("@buyer_nick", o.BuyerNick == null?"":o.BuyerNick),
                    new SqlParameter("@buyer_reallName", o.Buyer_reallName == null?"":o.Buyer_reallName),
                    new SqlParameter("@cellPhone", o.CellPhone == null ?"":o.CellPhone),
                    new SqlParameter("@province", o.BuyerProvince == null?"":o.BuyerProvince.ToString()),
                    new SqlParameter("@buyer_credit", o.Buyer_credit == null?"1":o.Buyer_credit),
                    new SqlParameter("@address", o.Address == null?"":o.Address),
                    new SqlParameter("@SELLER_ID", o.SELLER_ID)
                };
                DataBase.ExecuteSql(query, param);

                return(true);
            }
            catch (Exception ex)
            {
                ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
                return(false);
            }
        }
Beispiel #5
0
        private IActionResult register(UserTypes type)
        {
            switch (type)
            {
            case UserTypes.Buyer:
                User.Profile = new Buyer(Name, Email, "", "", Username, Password);
                Buyers.Create((Buyer)User.Profile);
                return(RedirectToPage("ShopCart"));

            case UserTypes.Bringer:
                User.Profile = new Bringer(Name, Email, "", 0, new List <Order>(), Username, Password);
                Bringers.Create((Bringer)User.Profile);
                throw new NotImplementedException("We have no bringer pages yet");
                return(RedirectToPage("<Bringer Start Page Here>"));    // send to start page for bringers

            case UserTypes.Store:
                User.Profile = new Store(Name, Email, "", "", 0, Username, Password);
                Stores.Create((Store)User.Profile);
                return(RedirectToPage("/Catalog/ProductCatalog"));

            default:
                //This should not happen, please throw an exception here
                return(Page());
            }
        }
Beispiel #6
0
        public void BuyerAdded(Buyer buyer)
        {
            var viewModel = new BuyerViewModel(buyer.Snapshot.ItemId, buyer.Snapshot);

            Buyers.Add(viewModel);
            buyer.AddBuyerListener(this);
        }
        public Buyers AddBuyer(Buyers buyer)
        {
            try
            {
                const string procedureName = "procInsertUpdateBuyer";
                using (SqlConnection sqlConnection = new SqlConnection(connection))
                {
                    SqlCommand sqlCommand = new SqlCommand(procedureName, sqlConnection);
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.Parameters.Add("@pId", SqlDbType.BigInt).Value = buyer.Id;
                    sqlCommand.Parameters.Add("@pBuyersName", SqlDbType.NVarChar, 128).Value  = buyer.BuyersName;
                    sqlCommand.Parameters.Add("@pBuyersCode", SqlDbType.NVarChar, 16).Value   = buyer.BuyersCode;
                    sqlCommand.Parameters.Add("@pBuyersRegion", SqlDbType.NVarChar, 32).Value = buyer.BuyersRegion;
                    sqlCommand.Parameters.Add("@pBuyersMobile", SqlDbType.NVarChar, 14).Value = buyer.BuyersMobile;
                    sqlCommand.Parameters.Add("@pBuyersEmail", SqlDbType.NVarChar, 32).Value  = buyer.BuyersEmail;
                    sqlCommand.Parameters.Add("@pIsUpdate", SqlDbType.Bit).Value = false;

                    sqlConnection.Open();
                    sqlCommand.ExecuteNonQuery();
                    sqlConnection.Close();
                }

                return(new Buyers());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #8
0
 /// <summary>
 /// 卖家手动添加买家基本信息.
 /// </summary>
 /// <param name="o"></param>
 /// <param name="sellerID"></param>
 /// <returns></returns>
 public bool AddBuyerBySeller(Buyers o)
 {
     try
     {
         string         query = @"insert into Buyer(buyer_id,SELLER_ID,buyer_nick,buyer_reallName,cellPhone,Phone,qq,msn,zipCode,
                         email,sinaWeibo,qqWeibo,province,city,createDate,buyerType)
                         values(@buyer_id,@SELLER_ID,@buyer_nick,@buyer_reallName,@cellPhone,@Phone,@qq,@msn,@zipCode,
                         @email,@sinaWeibo,@qqWeibo,@province,@city,getdate(),@buyerType)";
         SqlParameter[] param = new SqlParameter[]
         {
             new SqlParameter("@buyer_id", o.BuyerId),
             new SqlParameter("@SELLER_ID", o.SELLER_ID),
             new SqlParameter("@buyer_nick", o.BuyerNick),
             new SqlParameter("@buyer_reallName", o.Buyer_reallName),
             new SqlParameter("@cellPhone", o.CellPhone),
             new SqlParameter("@Phone", o.Phone),
             new SqlParameter("@qq", o.QQ),
             new SqlParameter("@msn", o.MSN),
             new SqlParameter("@zipCode", o.ZipCode),
             new SqlParameter("@email", o.Email),
             new SqlParameter("@sinaWeibo", o.SinaWeibo),
             new SqlParameter("@qqWeibo", o.QQWeibo),
             new SqlParameter("@province", o.BuyerProvince.ToString()),
             new SqlParameter("@city", o.City == null?"":o.City),
             new SqlParameter("@buyerType", o.BuyerType)
         };
         DataBase.ExecuteSql(query, param);
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
         return(false);
     }
 }
Beispiel #9
0
 /// <summary>
 /// 卖家手动添加其他店铺的买家基本信息.
 /// </summary>
 /// <param name="o"></param>
 /// <param name="sellerID"></param>
 /// <returns></returns>
 public bool AddBuyerOtherShop(Buyers o)
 {
     try
     {
         string         query = @"insert into Buyer(buyer_id,SELLER_ID,buyer_nick,province,city,address,buyer_credit,createDate,buyerType)
                         values(@buyer_id,@SELLER_ID,@buyer_nick,@province,@city,@address,@buyer_credit,getdate(),@buyerType)";
         SqlParameter[] param = new SqlParameter[]
         {
             new SqlParameter("@buyer_id", o.BuyerId),
             new SqlParameter("@SELLER_ID", o.SELLER_ID),
             new SqlParameter("@buyer_nick", o.BuyerNick),
             new SqlParameter("@province", o.BuyerProvince.ToString()),
             new SqlParameter("@city", o.City == null?"":o.City),
             new SqlParameter("@address", o.Address == null ? "" : o.Address),
             new SqlParameter("@buyerType", o.BuyerType),
             new SqlParameter("@buyer_credit", o.Buyer_credit == null ? "0" : o.Buyer_credit)
         };
         DataBase.ExecuteSql(query, param);
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Data);
         return(false);
     }
 }
Beispiel #10
0
        public void StolenBuyerExistsTest()
        {
            VerifyExists();
            bool value = Buyers.StolenBuyerExists(_databasePath, _buyerName, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
        public Buyers GetBuyer(long id)
        {
            try
            {
                var          buyer         = new Buyers();
                const string procedureName = "procGetBuyer";

                using (SqlConnection sqlConnection = new SqlConnection(connection))
                {
                    SqlCommand sqlCommand = new SqlCommand(procedureName, sqlConnection);
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlConnection.Open();
                    sqlCommand.CommandTimeout = 120;
                    using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
                    {
                        while (sqlDataReader.Read())
                        {
                            buyer.Id           = Convert.ToInt32(sqlDataReader["Id"]);
                            buyer.BuyersName   = sqlDataReader["BuyersName"].ToString();
                            buyer.BuyersCode   = sqlDataReader["BuyersCode"].ToString();
                            buyer.BuyersRegion = sqlDataReader["BuyersRegion"].ToString();
                            buyer.BuyersMobile = sqlDataReader["BuyersMobile"].ToString();
                            buyer.BuyersEmail  = sqlDataReader["BuyersEmail"].ToString();
                        }
                    }
                    sqlConnection.Close();
                }
                return(buyer);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #12
0
        public void AddTest()
        {
            VerifyDoesntExist();
            bool value = Buyers.Add(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerPhone, _buyerCountry, _buyerEMail, _buyerLic, _buyerWebSite, _buyerFax, _buyerDob, _buyerDLic, _buyerResident, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
Beispiel #13
0
 public void AddBuyers(uint amount, double initCash, uint initStorage, uint maxStorage)
 {
     for (int i = 0; i < amount; i++)
     {
         Buyers.Add(new Buyer(this, initCash, initStorage, maxStorage));
     }
 }
Beispiel #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         var buyerID = Request.QueryString["buyer_id"].ToString();
         if (!string.IsNullOrEmpty(buyerID))
         {
             Buyers buyer = new Buyers();
             buyer.BuyerId   = Convert.ToInt64(buyerID);
             buyer.SELLER_ID = Users.Nick;
             buyer.BuyerNick = BuyerBLL.GetBuyerNickByID(buyerID);
             DataTable tbBuyerBaseInfo = BuyerBLL.GetBuyerListFromDB(buyer);
             if (tbBuyerBaseInfo != null && tbBuyerBaseInfo.Rows.Count > 0)
             {
                 //会员基本信息
                 lbBuyerNick.Text   = tbBuyerBaseInfo.Rows[0]["buyer_nick"].ToString();
                 lbBuyerLevel.Text  = tbBuyerBaseInfo.Rows[0]["grade"].ToString();
                 lbBuyerStatus.Text = tbBuyerBaseInfo.Rows[0]["status"].ToString();
                 lbTradeAmount.Text = "¥" + tbBuyerBaseInfo.Rows[0]["trade_amount"].ToString();
                 //详细区域
                 txtRealName.Text   = tbBuyerBaseInfo.Rows[0]["buyer_reallName"].ToString();
                 txtCellphone.Text  = tbBuyerBaseInfo.Rows[0]["cellPhone"].ToString();
                 txtPhone.Text      = tbBuyerBaseInfo.Rows[0]["Phone"].ToString();
                 txtQQ.Text         = tbBuyerBaseInfo.Rows[0]["qq"].ToString();
                 dateBirthDay.Value = tbBuyerBaseInfo.Rows[0]["birthDay"].ToString();
                 txtZIPCode.Text    = tbBuyerBaseInfo.Rows[0]["zipCode"].ToString();
                 txtEmail.Text      = tbBuyerBaseInfo.Rows[0]["email"].ToString();
                 lbJifen.Text       = "0";
                 txtAddress.Text    = tbBuyerBaseInfo.Rows[0]["address"].ToString();
                 txtMemo.Text       = tbBuyerBaseInfo.Rows[0]["memo"].ToString();
             }
         }
     }
 }
Beispiel #15
0
        public void ExistsTest()
        {
            VerifyExists();
            bool value = Buyers.Exists(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity,
                                       _buyerState, _buyerZipCode, _buyerDob, _buyerDLic, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
Beispiel #16
0
        public void AddCashForBuyer(ServerBuyerDTO serverBuyerDTO)
        {
            tempBuyersOnline.FirstOrDefault(x => x.Name == serverBuyerDTO.Name &&
                                            x.Password == serverBuyerDTO.Password).Cash = serverBuyerDTO.Cash;
            Buyers temp = mapperBuyer.Map <ServerBuyerDTO, Buyers>(serverBuyerDTO);

            buyerWrapper.AddCashForBuyer(temp);
        }
Beispiel #17
0
 /// <summary>
 /// Verifies the doesnt exist.
 /// </summary>
 private void VerifyDoesntExist()
 {
     if (Buyers.Exists(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerDob, _buyerDLic, out _errOut))
     {
         long id    = Buyers.GetId(_databasePath, _buyerName, out _errOut);
         bool value = Buyers.Delete(_databasePath, id, out _errOut);
     }
 }
Beispiel #18
0
        public void loadBuyers()
        {
            //this function will load the data into grid
            myDAL objDAL = new myDAL();

            Buyers.DataSource = objDAL.GetBuyersList_DAL();
            Buyers.DataBind();
        }
Beispiel #19
0
        public void GetIdTest()
        {
            VerifyExists();
            long value = Buyers.GetId(_databasePath, _buyerName, out _errOut);

            TestContext.WriteLine($"ids: {value}");
            General.HasTrueValue(value > 0, _errOut);
        }
Beispiel #20
0
        public void SoldFirearmTest()
        {
            VerifyExists();
            long id    = Buyers.GetId(_databasePath, _buyerName, out _errOut);
            bool value = Buyers.FirearmBought(_databasePath, _gunId, id, DateTime.Now.ToString(CultureInfo.InvariantCulture), "400.00", out _errOut);

            General.HasTrueValue(value, _errOut);
        }
Beispiel #21
0
        private void Join()
        {
            IStockItemConnection itemConnection = _connection.ConnectToItem(NewItemId);
            var viewModel = new BuyerViewModel(NewItemId, NewItemMaximumPrice, NumberToBuy,
                                               _buyerName, itemConnection, _repository);

            Buyers.Add(viewModel);
        }
Beispiel #22
0
        public void GetListAllTest()
        {
            VerifyExists();
            List <BuyersList> value = Buyers.Get(_databasePath, out _errOut);

            PrintList(value);
            General.HasTrueValue(value.Count > 0, _errOut);
        }
Beispiel #23
0
        public static string GetFioBuyer(this Buyers buyers)
        {
            if (buyers == null)
            {
                return(string.Empty);
            }

            return($"{buyers.SurName} {buyers.FirstName} {buyers.Patronymic}");
        }
Beispiel #24
0
        public void GetListByIdTest()
        {
            VerifyExists();
            long id = Buyers.GetId(_databasePath, _buyerName, out _errOut);
            List <BuyersList> value = Buyers.Get(_databasePath, id, out _errOut);

            PrintList(value);
            General.HasTrueValue(value.Count > 0, _errOut);
        }
        //管理员删除买手信息
        public int Delete(Buyers us)
        {
            string sql = "delete into Buyers values(@Buyers_id)";

            SqlParameter[] sp = new SqlParameter[] {
                new SqlParameter("@Buyers_id", us.Buyers_id)
            };
            return(DBHelper.GetExcuteNonQuery(sql, sp));
        }
 public PropertySaleInformation ToDomainModel()
 {
     return(new PropertySaleInformation(PurchasePrice,
                                        State,
                                        PropertyType,
                                        Buyers.Select(b =>
                                                      new PropertyBuyer(b.BuyerNumber, b.IntendedUse, b.FirstHomeBuyer, b.IsForeignBuyer, b.PurchaseFraction)).ToArray()
                                        ));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                var buyerID = Request.QueryString["buyer_id"].ToString();
                if (!string.IsNullOrEmpty(buyerID))
                {
                    Buyers buyer = new Buyers();
                    buyer.BuyerId   = Convert.ToInt64(buyerID);
                    buyer.BuyerNick = BuyerBLL.GetBuyerNickByID(buyerID);
                    buyer.SELLER_ID = Users.Nick;
                    DataTable tbBuyerBaseInfo = BuyerBLL.GetBuyerListFromDB(buyer);
                    if (tbBuyerBaseInfo != null && tbBuyerBaseInfo.Rows.Count > 0)
                    {
                        //会员基本信息
                        lbBuyerNick.Text         = tbBuyerBaseInfo.Rows[0]["buyer_nick"].ToString();
                        lbBuyerLevel.Text        = tbBuyerBaseInfo.Rows[0]["grade"].ToString();
                        lbBuyerStatus.Text       = tbBuyerBaseInfo.Rows[0]["status"].ToString();
                        lbTradeAmount.Text       = tbBuyerBaseInfo.Rows[0]["trade_amount"].ToString();
                        lbTradeCount.Text        = tbBuyerBaseInfo.Rows[0]["trade_count"].ToString();
                        lbTradeProductCount.Text = tbBuyerBaseInfo.Rows[0]["item_num"].ToString();
                        lbCloseTradeCount.Text   = tbBuyerBaseInfo.Rows[0]["close_trade_count"].ToString();
                        lbCloseTradeAmount.Text  = tbBuyerBaseInfo.Rows[0]["close_trade_amount"].ToString();
                        if (lbCloseTradeAmount.Text != "0.00")
                        {
                            lbCloseTradeAmount.ForeColor = Color.Red;
                        }
                        lbBuyerCredit.Text = tbBuyerBaseInfo.Rows[0]["buyer_credit"].ToString();
                        if (!string.IsNullOrEmpty(lbBuyerCredit.Text))
                        {
                            imgcredit.ImageUrl    = "Images/credit/" + lbBuyerCredit.Text.Trim() + ".png";
                            lbBuyerCredit.Visible = false;
                        }
                        else
                        {
                            lbBuyerCredit.Visible = true;
                            imgcredit.Visible     = false;
                        }

                        lbisRefund.Text = tbBuyerBaseInfo.Rows[0]["hasRefund"].ToString();
                        if (lbisRefund.Text.Equals("是"))
                        {
                            lbisRefund.ForeColor = Color.Red;
                        }
                        lbRealName.Text  = tbBuyerBaseInfo.Rows[0]["buyer_reallName"].ToString();
                        lbCellPhone.Text = tbBuyerBaseInfo.Rows[0]["cellPhone"].ToString();
                        lbQQ.Text        = tbBuyerBaseInfo.Rows[0]["qq"].ToString();
                        lbPhone.Text     = tbBuyerBaseInfo.Rows[0]["Phone"].ToString();
                        lbAddress.Text   = tbBuyerBaseInfo.Rows[0]["address"].ToString();
                        lbZipCode.Text   = tbBuyerBaseInfo.Rows[0]["zipCode"].ToString();
                        lbBirthDay.Text  = tbBuyerBaseInfo.Rows[0]["birthDay"].ToString();
                        lbmemo.Text      = tbBuyerBaseInfo.Rows[0]["memo"].ToString();
                    }
                }
            }
        }
Beispiel #28
0
        public Buyers Buyer(int?Id)
        {
            Buyers buyer = new Buyers();

            if (Id != null)
            {
                buyer = _context.Buyers.Find(Id);
            }
            return(buyer);
        }
    public DataTable InsertBuyer(Buyers buyer)
    {
        DataTable dt = null;

        using (BuyerGateway buyerGateway = new BuyerGateway())
        {
            dt = buyerGateway.InsertBuyer(buyer);
        }
        return(dt);
    }
Beispiel #30
0
        public void DeleteTest()
        {
            VerifyExists();
            long id = Buyers.GetId(_databasePath, _buyerName, out _errOut);

            TestContext.WriteLine($"Deleting Buyr with the id of {id} ");
            bool value = Buyers.Delete(_databasePath, id, out _errOut);

            General.HasTrueValue(value, _errOut);
        }