Exemplo n.º 1
0
        // GET: BidViewByProductId
        public ActionResult GetBidById(int id)
        {
            BidDetail bid = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://localhost:44320/api/");
                string token = DeserializeToken();
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
                var responseTask = client.GetAsync("bid/" + id.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <BidDetail>();
                    readTask.Wait();

                    bid = readTask.Result;
                }
                else
                {
                    ModelState.AddModelError(string.Empty, result.Content.ReadAsStringAsync().Result);
                }
            }
            return(View(bid));
        }
        /// Function Name : Reject Bid Details
        /// Parameter Details
        /// 1. BidDetail DTO
        ///
        /// Functionality
        /// This function accept Bid details DTO and mark the bid as rejected based on the Bid ID
        ///
        public HttpResponseMessage RejectBid(BidDetail objBidDetail)
        {
            #region declaration
            DataTable dt     = new DataTable();
            string    sQuery = "";
            Random    r      = new Random();
            DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[2];
            int iParamCount = 0;
            #endregion

            DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString);

            objParam[iParamCount].sParamName  = "@vQueryType";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = "REJECTBID";
            iParamCount++;

            objParam[iParamCount].sParamName  = "@bid";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.BidID);
            iParamCount++;


            sQuery  = ProcBidOperation_Bid;
            sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt);
            if (sRetVal == "SUCCESS")
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Bid Rejected Successfully"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal));
            }
        }
Exemplo n.º 3
0
 public bool DeleteBidDetail(BidDetail bidDetail)
 {
     if (bidDetail == null)
     {
         return(false);
     }
     _unitOfWork.BidDetailRepository.Delete(bidDetail);
     _unitOfWork.Save();
     return(true);
 }
Exemplo n.º 4
0
        public ActionResult UpdateMaxPrice(Product model)
        {
            BidDetail c = new BidDetail();

            using (var ctx = new QLBHEntities())
            {
                ctx.Entry(model).State =
                    System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
            }
            return(RedirectToAction("Detail", "Product", new { id = model.ProID }));
        }
Exemplo n.º 5
0
        public ActionResult Detail(BidDetail model, int id)
        {
            BidDetail bid = new BidDetail();

            using (var ctx = new QLBHEntities())
            {
                bid.BidPrice = ctx.BidDetails.Where(p => p.ProID == model.ProID).Max(p => p.BidPrice);
            }
            using (var ctx = new QLBHEntities())
            {
                ctx.BidDetails.Add(model);
                ctx.SaveChanges();
            }
            return(RedirectToAction("EditMaxPrice", "Product", new { proid = model.ProID, bidprice = model.BidPrice, bidpricemaxbefore = bid.BidPrice }));
        }
Exemplo n.º 6
0
    protected void btn_insert_Click(object sender, EventArgs e)
    {
        DataContext       db    = new DataContext("Data Source=RICHA1\\SQLEXPRESS;Initial Catalog=rich;uid=sa;pwd=info123!");
        Table <BidDetail> table = db.GetTable <BidDetail>();
        BidDetail         bd    = new BidDetail()
        {
            BID             = Convert.ToInt32(txt_bid.Text),
            Domain          = txt_domain.Text,
            Name            = txt_name.Text,
            ProjectDuration = Convert.ToInt32(txt_duration.Text),
            TeamRequired    = Convert.ToInt32(txt_team.Text),
        };

        table.InsertOnSubmit(bd);
        db.SubmitChanges();
    }
Exemplo n.º 7
0
 public bool EditBidDetail(BidDetail bidDetail)
 {
     _unitOfWork.BidDetailRepository.Edit(bidDetail);
     _unitOfWork.Save();
     return(true);
 }
Exemplo n.º 8
0
 public bool AddBidDetail(BidDetail bidDetail)
 {
     _unitOfWork.BidDetailRepository.Add(bidDetail);
     _unitOfWork.Save();
     return(true);
 }
        //***************************************** Place Bid **************************************************
        //      PlaceBid     :   Place the bid for a specific consignment                                       *
        //      GetBidDetail :   Get the bid detail on the basis of different filter Crieteria                  *
        //      UpdateBid    :   Update Bid Details. Only Bid amount can modify                                 *
        //      DeleteBid    :   Delete bid on the basis of bid ID                                              *
        //
        //*******************************************************************************************************

        /// Function Name : Place Bid
        /// Parameter Details
        /// 1. BidDetail DTO
        ///
        /// Functionality
        /// This function accept Bid details DTO and store into DB
        /// Value of Load ID, User ID, Amount is mandatory

        public HttpResponseMessage PlaceBid(BidDetail objBidDetail)
        {
            #region declaration
            DataTable dt     = new DataTable();
            string    sQuery = "";
            Random    r      = new Random();
            DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[9];
            int iParamCount = 0;
            #endregion


            DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString);

            objParam[iParamCount].sParamName  = "@vQueryType";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = "PLACEBID";
            iParamCount++;

            objParam[iParamCount].sParamName  = "@bid";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = "0";
            iParamCount++;

            objParam[iParamCount].sParamName  = "@cid";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.CId);
            iParamCount++;

            objParam[iParamCount].sParamName  = "@bidamount";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.BidAmount);
            iParamCount++;

            objParam[iParamCount].sParamName  = "@userid";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.UserID);
            iParamCount++;

            objParam[iParamCount].sParamName  = "@viewed";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = objBidDetail.Viewed;
            iParamCount++;

            objParam[iParamCount].sParamName  = "@status";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.Status);
            iParamCount++;

            objParam[iParamCount].sParamName  = "@creationdatetime";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.CreationDateTime.ToString("dd-MM-yyyy"));
            iParamCount++;

            objParam[iParamCount].sParamName  = "@BidUpdateDateTime";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = Convert.ToString(objBidDetail.BidUpdateDateTime.ToString("dd-MM-yyyy"));;
            iParamCount++;

            sQuery  = "ProcBidOperation";
            sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC_UPDATE, objParam, ref dt);
            if (sRetVal == "SUCCESS")
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Bid Placed Successfully"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal));
            }
        }
Exemplo n.º 10
0
        public HttpResponseMessage GetBidDetail(BidDetail objBidDetail)
        {
            #region declaration
            DataTable dt     = new DataTable();
            string    sQuery = "";
            Random    r      = new Random();
            DBOperation.StructDBOperation[] objParam = new DBOperation.StructDBOperation[2];
            int    iParamCount = 0;
            string sFilter     = "";
            #endregion

            DBOperation.sConnectionString = ec.Decrypt(GlobalClass.sConnectionString);

            #region Prepare Query Filter
            if (objBidDetail.BidID > 0)
            {
                sFilter += " AND bid_id=" + objBidDetail.BidID;
            }
            if (objBidDetail.CId > 0)
            {
                sFilter += " AND load_id=" + objBidDetail.CId;
            }
            if (objBidDetail.BidAmount > 0)
            {
                sFilter += " AND Bid_Amount=" + objBidDetail.BidAmount;
            }
            if (objBidDetail.UserID > 0)
            {
                sFilter += " AND User_ID=" + objBidDetail.UserID;
            }
            if (!string.IsNullOrEmpty(objBidDetail.Viewed))
            {
                sFilter += " AND Viewed=" + objBidDetail.Viewed;
            }

            if (sFilter.Length > 4)
            {
                sFilter = "Where " + sFilter.Substring(4);
            }
            #endregion

            objParam[iParamCount].sParamName  = "@vQueryType";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = "CONSIGNMENTDETAIL";
            iParamCount++;

            objParam[iParamCount].sParamName  = "@vFilterClause";
            objParam[iParamCount].sParamType  = SqlDbType.VarChar;
            objParam[iParamCount].sParamValue = sFilter;
            iParamCount++;


            sQuery  = "ProcGetBidDetail";
            sRetVal = DBOperation.ExecuteDBOperation(sQuery, DBOperation.OperationType.STOREDPROC, objParam, ref dt);
            if (sRetVal == "SUCCESS")
            {
                return(Request.CreateResponse(HttpStatusCode.OK, dt));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, "Please Contact Administrator with below mentioned error " + sRetVal));
            }
        }