示例#1
0
        public bool Save(DealEL DealEL, out string Responcetxt)
        {
            ProcedureExecute proc;
            bool             Res = false; string strError = string.Empty;

            try
            {
                using (proc = new ProcedureExecute("prcDeal"))
                {
                    proc.AddVarcharPara("@Action", 100, "Save");
                    proc.AddVarcharPara("@ProductUsed", 200, DealEL.ProductUsed);
                    proc.AddIntegerPara("@CategoryId", DealEL.CategoryId);
                    proc.AddBooleanPara("@IsBranded", DealEL.IsBranded);
                    proc.AddVarcharPara("@Title", 200, DealEL.Title);
                    proc.AddVarcharPara("@SKU", 200, DealEL.SKU);
                    proc.AddVarcharPara("@Description", 200, DealEL.Description);
                    proc.AddVarcharPara("@Question", 200, DealEL.Question);
                    proc.AddVarcharPara("@OriginalPrice", 200, DealEL.OriginalPrice);
                    proc.AddVarcharPara("@DealPrice", 200, DealEL.DealPrice);
                    proc.AddDateTimePara("@DealDate", DealEL.DealDate);
                    proc.AddVarcharPara("@DealTime", 200, DealEL.DealTime);
                    proc.AddVarcharPara("@StartingBid", 200, DealEL.StartingBid);
                    proc.AddVarcharPara("@ShipWithin", 200, DealEL.ShipWithin);
                    proc.AddVarcharPara("@DeliveryTime", 200, DealEL.DeliveryTime);
                    proc.AddVarcharPara("@ShipCountry", 200, DealEL.ShipCountry);
                    proc.AddVarcharPara("@ShippingPrice", 200, DealEL.ShippingPrice);
                    proc.AddBooleanPara("@IsFreeShipping", DealEL.IsFreeShipping);
                    proc.AddBooleanPara("@IsShippedEverywhere", DealEL.IsShippedEverywhere);
                    proc.AddVarcharPara("@Images", 800, DealEL.images);
                    proc.AddNVarcharPara("@ReturnValue", 500, DealEL.ReturnValue, QueryParameterDirection.Output);

                    int i = proc.RunActionQuery();
                    if (i > 0)
                    {
                        Res           = true;
                        DealEL.DealId = Convert.ToInt32(proc.GetParaValue("@ReturnValue"));
                        strError      = "Item added successfully.";
                    }
                    else
                    {
                        strError = Convert.ToString(proc.GetParaValue("@ReturnValue"));
                    }

                    Responcetxt = strError;
                    return(Res);
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                proc = null;
            }
        }
示例#2
0
 //private void PopulateAuction()
 //{
 //    DealBL objDealBL = new DealBL();
 //    DataTable dtAuction = objDealBL.GetAuction(Convert.ToString(Session["UserType"]), Convert.ToInt32(Session["UserId"]));
 //    auction.DataSource = dtAuction;
 //    auction.DataTextField = "AuctionName";
 //    auction.DataValueField = "AuctionId";
 //    auction.DataBind();
 //}
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         DealBL objDealBL   = new DealBL();
         DealEL objDealEL   = new DealEL();
         string Responsetxt = string.Empty;
         string dealimages  = Request["hdnimagefiles"];
         objDealEL.ProductUsed = ItemUsed.SelectedItem.ToString();
         if (!categotyLevel2.Visible)
         {
             objDealEL.CategoryId = Convert.ToInt32(categotyLevel1.SelectedValue);
         }
         else
         {
             if (categotyLevel3.Visible)
             {
                 objDealEL.CategoryId = Convert.ToInt32(categotyLevel3.SelectedValue);
             }
             else
             {
                 objDealEL.CategoryId = Convert.ToInt32(categotyLevel2.SelectedValue);
             }
         }
         //objDealEL.AuctionId = Convert.ToInt32(auction.SelectedValue);
         objDealEL.IsBranded   = rdbYes.Checked;
         objDealEL.Title       = txtTitle.Text;
         objDealEL.SKU         = txtSKU.Text;
         objDealEL.Description = txtDesc.Text;
         objDealEL.Question    = txtQuestion.Text;
         //objDealEL.Quantity = Convert.ToInt32(txtQuantity.Text);
         //objDealEL.CostBasis = txtCost.Text;
         objDealEL.OriginalPrice = txtOriginalPrice.Text;
         objDealEL.DealPrice     = TxtDealPrice.Text;
         objDealEL.DealDate      = DateTime.ParseExact(auctiondate.Text, "dd-MM-yyyy", null);
         objDealEL.DealTime      = auctiontime.Text;
         //objDealEL.StartingBid = txtStartBid.Text;
         objDealEL.ShipCountry         = ddlCountry.Text;
         objDealEL.ShipWithin          = ddlShipWithin.Text;
         objDealEL.DeliveryTime        = ddlTimeTake.Text;
         objDealEL.IsFreeShipping      = chkFreeShipping.Checked;
         objDealEL.ShippingPrice       = ddlPrice.Text;
         objDealEL.IsShippedEverywhere = chkShip.Checked;
         objDealEL.images = dealimages;
         if (objDealBL.Save(objDealEL, out Responsetxt))
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "alert('" + Responsetxt + "');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "alert('" + Responsetxt + "');", true);
         }
     }
 }