예제 #1
0
 private tblOffer GetBaseOffer()
 {
     if (FBaseOffer == null)
     {
         FBaseOffer = FDocumrnt.tblManipulation.tblOffer;
     }
     return(FBaseOffer);
 }
예제 #2
0
        private void PrepareDefaultOffers()
        {
            foreach (var xOffer in FViewDataContext.DictOffers)
            {
                switch (xOffer.Classification)
                {
                case OfferClassification.Monitor: FDefMonitorReception = xOffer; break;

                case OfferClassification.PrimaryReception: FDefPrimaryReception = xOffer; break;

                case OfferClassification.PaidReception: FDefPaidReception = xOffer; break;
                }
            }
            FDefOfferPrepared = true;
        }
예제 #3
0
        protected void dg_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "AddANewRow")
                {
                    var      db          = new Pizza15Model();
                    TextBox  txtHeadingF = e.Item.FindControl("txtHeadingF") as TextBox;
                    TextBox  txtOfferF   = e.Item.FindControl("txtOfferF") as TextBox;
                    TextBox  txtEndLineF = e.Item.FindControl("txtEndLineF") as TextBox;
                    CheckBox chkActiveF  = e.Item.FindControl("chkActiveF") as CheckBox;

                    if (txtHeadingF != null && txtOfferF != null && txtEndLineF != null && chkActiveF != null)
                    {
                        var strQueryMax = db.tblOffers.Max(x => x.OfferID);
                        int nMaxID      = Convert.ToInt32(strQueryMax);

                        var strQuery = new tblOffer();
                        if (nMaxID != 0)
                        {
                            strQuery.OfferID = nMaxID + 1;
                        }
                        else
                        {
                            strQuery.OfferID = 1;
                        }

                        strQuery.Heading = txtHeadingF.Text;
                        strQuery.Offer   = txtOfferF.Text;
                        strQuery.EndLine = txtEndLineF.Text;
                        strQuery.Active  = Convert.ToBoolean(chkActiveF.Checked);
                        db.tblOffers.Add(strQuery);
                        db.SaveChanges();
                    }
                    else
                    {
                        lblError.Text = "Error finding the Offers";
                    }

                    Session["Offer"] = null;
                    GetData();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
예제 #4
0
        public int CreateOffer(Offer offer)
        {
            using (var scope = new TransactionScope())
            {
                var newOffer = new tblOffer
                {
                    PropertyID = offer.Property,
                    BuyerID    = offer.Buyer,
                    SellerID   = offer.Seller,
                    StatusID   = offer.Status
                };

                _unitOfWork.OfferRepository.Insert(newOffer);
                _unitOfWork.Save();
                scope.Complete();
                return(newOffer.OfferID);
            }
        }
예제 #5
0
        protected void dg_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                string strID  = dg.DataKeys[e.Item.ItemIndex].ToString();
                int    nStrID = Convert.ToInt32(strID);

                TextBox  txtHeadingE = e.Item.FindControl("txtHeadingE") as TextBox;
                TextBox  txtOfferE   = e.Item.FindControl("txtOfferE") as TextBox;
                TextBox  txtEndLineE = e.Item.FindControl("txtEndLineE") as TextBox;
                CheckBox chkActiveE  = e.Item.FindControl("chkActiveE") as CheckBox;

                if (txtHeadingE != null && txtOfferE != null && txtEndLineE != null && chkActiveE != null)
                {
                    var      db          = new Pizza15Model();
                    tblOffer UpdateOffer = db.tblOffers.FirstOrDefault(x => x.OfferID.Equals(nStrID));

                    if (UpdateOffer != null)
                    {
                        UpdateOffer.Heading = txtHeadingE.Text.Trim();
                        UpdateOffer.Offer   = txtOfferE.Text.Trim();
                        UpdateOffer.EndLine = txtEndLineE.Text.Trim();
                        UpdateOffer.Active  = Convert.ToBoolean(chkActiveE.Checked);
                        db.SaveChanges();
                    }
                }
                else
                {
                    lblError.Text = "Error finding the Offers";
                }

                dg.EditItemIndex = -1;
                dg.ShowFooter    = true;
                Session["Offer"] = null;
                GetData();
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
예제 #6
0
        private void AddManipulation(tblOffer offer, tblEmployee employee = null)
        {
            tblPatientInfo xPatientInfo = FViewDataContext.CurrentPatient;

            if (xPatientInfo == null)
            {
                System.Windows.MessageBox.Show("Не выбран пациент");
                return;
            }

            tblManipulation xManipulation = new tblManipulation()
            {
                tblPatient      = xPatientInfo,
                tblOffer        = offer,
                Price           = offer.DefaultPrice,
                DateRealization = DateTime.Now,
                Eye             = Eye.OU,
                tblEmployee     = employee
            };

            xPatientInfo.tblManipulationsObs.Add(xManipulation);
        }
예제 #7
0
        private void btnAddManipulation_Click(object sender, RoutedEventArgs e)
        {
            tblOffer xOffer = (tblOffer)((Button)sender).Tag;

            AddManipulation(xOffer);
        }
예제 #8
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        tblOffer             offer             = new tblOffer();
        tblOfferNotification offernotification = new tblOfferNotification();

        if (Session["clientPostId"] != null && Session["clientId"] != null)
        {
            offer.CompanyId       = Convert.ToInt32(Session["userid"].ToString());
            offer.PostId          = Convert.ToInt32(Session["clientPostId"].ToString());
            offer.ClientId        = Convert.ToInt32(Session["clientId"].ToString());
            offer.MessageToClient = txtMessage.Text;
            offer.Status          = "Active";
            var    timeZone = TimeZoneInfo.FindSystemTimeZoneById("Bangladesh Standard Time");
            var    now      = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZone);
            string date     = now.ToString("yyyy-MM-dd hh:mm:ss tt");
            offer.OfferDate = Convert.ToDateTime(date);
            if (fupSpecification.HasFile)
            {
                string fileNameSpecification = fupSpecification.FileName.Replace(",", "");
                offer.Specification = fileNameSpecification;
                fupSpecification.SaveAs(Server.MapPath("../UploadedFiles/" + fileNameSpecification));
            }
            db.tblOffers.Add(offer);
            db.SaveChanges();

            offernotification.OfferId          = offer.Id;
            offernotification.PostId           = offer.PostId;
            offernotification.NotificationDate = offer.OfferDate;
            db.tblOfferNotifications.Add(offernotification);
            db.SaveChanges();

            Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Offer sent successfully!" + "');", true);
            GridView2.DataBind();
            Response.Redirect(Request.RawUrl);
        }
        else if (Session["PostIdFromNotification"] != null && Session["ClientIdFromNotification"] != null)
        {
            offer.CompanyId       = Convert.ToInt32(Session["userid"].ToString());
            offer.PostId          = Convert.ToInt32(Session["PostIdFromNotification"].ToString());
            offer.ClientId        = Convert.ToInt32(Session["ClientIdFromNotification"].ToString());
            offer.MessageToClient = txtMessage.Text;
            offer.Status          = "Active";
            var    timeZone = TimeZoneInfo.FindSystemTimeZoneById("Bangladesh Standard Time");
            var    now      = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZone);
            string date     = now.ToString("yyyy-MM-dd hh:mm:ss tt");
            offer.OfferDate = Convert.ToDateTime(date);
            if (fupSpecification.HasFile)
            {
                string fileNameSpecification = fupSpecification.FileName.Replace(",", "");
                offer.Specification = fileNameSpecification;
                fupSpecification.SaveAs(Server.MapPath("../UploadedFiles/" + fileNameSpecification));
            }
            db.tblOffers.Add(offer);
            db.SaveChanges();

            offernotification.OfferId          = offer.Id;
            offernotification.PostId           = offer.PostId;
            offernotification.NotificationDate = offer.OfferDate;
            db.tblOfferNotifications.Add(offernotification);
            db.SaveChanges();

            Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Offer sent successfully!" + "');", true);
            GridView2.DataBind();
            Response.Redirect(Request.RawUrl);
        }
    }