Ejemplo n.º 1
0
 public static Tenders GetTenderById(int id)
 {
     using (var dc = new RentooloEntities())
     {
         Tenders tender = dc.Tenders.Where(x => x.Id == id).First();
         return(tender);
     }
 }
Ejemplo n.º 2
0
 public static void CreateTender(Tenders tender)
 {
     using (var dc = new RentooloEntities())
     {
         dc.Tenders.Add(tender);
         dc.SaveChanges();
     }
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                tender = TendersHelper.GetTenderById(Convert.ToInt32(Request.QueryString["id"]));

                TextBoxCost.Text = "0";
            }
        }
Ejemplo n.º 4
0
 public static void UpdateAllTender(Tenders tender, int oldTenderId)
 {
     using (var dc = new RentooloEntities())
     {
         Tenders oldTender = dc.Tenders.First(x => x.Id == oldTenderId);
         int     oldId     = oldTender.Id;
         UpdateAllTenderFields(oldTender, tender);
         oldTender.Id = oldId;
         dc.SaveChanges();
     }
 }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                tender = TendersHelper.GetTenderById(Convert.ToInt32(Request.QueryString["id"]));

                var user = DataHelper.GetUser(tender.UserOwnerId);
                UserId   = user.UserId.ToString();
                UserName = user.UserName;

                TextBoxCost.Text = "0";
            }
        }
Ejemplo n.º 6
0
 public static void UpdateAllTenderFields(Tenders oldItem, Tenders newItem)
 {
     oldItem.Id          = newItem.Id;
     oldItem.Name        = newItem.Name;
     oldItem.Description = newItem.Description;
     oldItem.UserOwnerId = newItem.UserOwnerId;
     oldItem.Cost        = newItem.Cost;
     oldItem.ImgUrls     = newItem.ImgUrls;
     oldItem.Status      = newItem.Status;
     oldItem.Created     = newItem.Created;
     oldItem.CurrencyId  = newItem.CurrencyId;
     oldItem.CategoryId  = newItem.CategoryId;
 }
Ejemplo n.º 7
0
        protected void ButtonAddRequest_Click(object sender, EventArgs e)
        {
            int    cost        = Convert.ToInt32(TextBoxCost.Text);
            string description = TextBoxDescription.Text;
            int    tenderId    = Convert.ToInt32(Request.QueryString["id"]);

            tender = TendersHelper.GetTenderById(tenderId);

            TenderRequest tenderRequest = new TenderRequest()
            {
                // ид текущего пользователя
                ProviderId = User.UserId,
                // id владельца тендера
                CustomerId   = tender.UserOwnerId,
                Description  = description,
                Cost         = cost,
                TenderId     = tenderId,
                ProviderName = User.UserName
            };

            TendersHelper.CreateTenderRequest(tenderRequest);
        }