예제 #1
0
 public void searchcat()
 {
     if (ddlSubSubCat.Visible == true)
     {
         PropPurchase obj = new PropPurchase();
         obj.subsubcatname      = ddlSubSubCat.SelectedItem.Text;
         PanelOrder.Visible     = false;
         PanResult.Visible      = false;
         Panelvendor.Visible    = false;
         PanelDate.Visible      = false;
         GridViewcat.DataSource = BusinessSearch.busSearchbyCatwithSubSubCat(obj);
         PanelCat.Visible       = true;
         Panelcustom.Visible    = false;
         GridViewcat.DataBind();
     }
     else
     {
         PropPurchase obj = new PropPurchase();
         obj.Purchase_category  = ddlCategory.SelectedItem.Text;
         obj.subcatname         = ddlSubCat.SelectedItem.Text;
         PanelOrder.Visible     = false;
         PanResult.Visible      = false;
         Panelvendor.Visible    = false;
         PanelDate.Visible      = false;
         GridViewcat.DataSource = BusinessSearch.busSearchbyCatwithoutSubSubCat(obj);
         PanelCat.Visible       = true;
         Panelcustom.Visible    = false;
         GridViewcat.DataBind();
     }
 }
예제 #2
0
        public void fill()
        {
            PropPurchase prp = new PropPurchase();

            grdvViewPurchaseOrder.DataSource = BusinessSearch.busHistory(prp);
            grdvViewPurchaseOrder.DataBind();
        }
예제 #3
0
        protected void bntcalculateResult_Click(object sender, EventArgs e)
        {
            DataSet      ds  = new DataSet();
            PropPurchase obj = new PropPurchase();

            obj.pName            = ddlSearchItemName.SelectedItem.Text;
            obj.Destination_name = ddlSitename.SelectedItem.Text;

            ds = BusinessSearch.buscalculatefill(obj);
            decimal minprice = Convert.ToDecimal(ds.Tables[1].Rows[0]["Column1"].ToString());
            decimal maxprice = Convert.ToDecimal(ds.Tables[2].Rows[0]["Column1"].ToString());

            avgprice           = Convert.ToDecimal(ds.Tables[3].Rows[0]["Column1"].ToString());
            lblopminprice.Text = minprice.ToString() + " " + " Rs.";
            lblOpMaxPrice.Text = maxprice.ToString() + " " + " Rs.";
            lblOpAvg.Text      = avgprice.ToString() + " " + " Rs.";



            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                decimal qty  = Convert.ToDecimal(ds.Tables[0].Rows[i]["Purchase_qty"].ToString());
                decimal rate = Convert.ToDecimal(ds.Tables[0].Rows[i]["Purchase_rate"].ToString());

                qtyresult = qtyresult + qty;
                result    = result + qty * rate;

                pnlResult.Visible = true;
                lblqty.Text       = qtyresult.ToString();

                lblOpResult.Text = result.ToString() + " " + " Rs.";
            }
        }
예제 #4
0
        protected void GrdvViewStock_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            PropPurchase prop = new PropPurchase();

            prop.Purchase_Id = Convert.ToInt32(grdvViewPurchaseOrder.DataKeys[e.RowIndex].Value.ToString());

            TextBox t1 = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtPurcahseOrno");

            prop.PurchaseOr_No = t1.Text;

            TextBox t2 = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtItemName");

            prop.pName = t2.Text;

            TextBox t3 = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtPurchaseaDate");

            prop.date = Convert.ToDateTime(t3.Text);

            DropDownList t4 = (DropDownList)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("drpEditCategory");

            prop.Purchase_category = t4.SelectedItem.Text;


            TextBox t5 = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtQuantity");

            prop.quantity = Convert.ToDecimal(t5.Text);

            TextBox t6 = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtRate");

            prop.price = Convert.ToDecimal(t6.Text);

            TextBox t7 = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtVendorName");

            prop.vName = t7.Text;

            DropDownList t8 = (DropDownList)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("ddlUnit");

            prop.Unitname = t8.SelectedItem.Text;

            DropDownList t9 = (DropDownList)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("drpEditSubCategory");

            prop.subcatname = t9.SelectedItem.Text;

            DropDownList t10 = (DropDownList)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("drpEditSubSubCategory");

            prop.subsubcatname = t10.SelectedItem.Text;

            TextBox day = (TextBox)grdvViewPurchaseOrder.Rows[e.RowIndex].FindControl("txtday");

            prop.day = day.Text;

            BusinessSearch.busSearchUpdate(prop);


            grdvViewPurchaseOrder.EditIndex = -1;
            fill();
        }
예제 #5
0
        public YelpGUI()
        {
            this.InitializeComponent();
            UserInformation userInformation = new UserInformation();
            BusinessSearch  businessSearch  = new BusinessSearch();

            userInformation.UserInformationEngine.PropertyChanged += businessSearch.UserChanged;
            this.UserInformationFrame.Content     = userInformation;
            this.BusinessInformationFrame.Content = new BusinessInformation();
            this.BusinessSearchFrame.Content      = businessSearch;
        }
예제 #6
0
        protected void GrdvViewStock_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            PropPurchase prop = new PropPurchase();

            prop.Purchase_Id = Convert.ToInt32(grdvViewPurchaseOrder.DataKeys[e.RowIndex].Value.ToString());

            BusinessSearch.busDeleteHistory(prop);


            grdvViewPurchaseOrder.EditIndex = -1;
            fill();
        }
예제 #7
0
        public void fillcustom()
        {
            propInventory prpcustom = new propInventory();

            prpcustom.Itemname = txtcustom.Text;
            DataSet dsop = new DataSet();

            dsop = BusinessSearch.businventorycustomsearch(prpcustom);

            PanResult.Visible         = true;
            grdvViewResult.DataSource = dsop;

            grdvViewResult.DataBind();
        }
예제 #8
0
        public ActionResult Index(BusinessSearch model)
        {
            var CatList    = db.Categories.Select(c => c.Category).Distinct().ToArray();
            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            ViewData["CatList"] = serializer.Serialize(CatList);

            var CityList = db.Businesses.Select(c => c.Business_City).Distinct().ToArray();

            ViewData["CityList"] = serializer.Serialize(CityList);

            if (!string.IsNullOrEmpty(model.SearchButton) || model.Page.HasValue)
            {
                if (model.Category == null)
                {
                    model.Category = this.Request.QueryString["BusinessCategory"];
                }
                if (model.City == null)
                {
                    model.City = this.Request.QueryString["BusinessCity"];
                }
                if (model.State == null)
                {
                    model.State = this.Request.QueryString["BusinessState"];
                }

                var results = (from b in db.Businesses
                               join c in db.Categories
                               on b.Business_ID equals c.Business_ID into bc
                               from c in bc.DefaultIfEmpty()
                               select new BusinessCategoryView()
                {
                    Business_ID = b.Business_ID,
                    Business_Name = b.Business_Name,
                    Category = c.Category,
                    Business_City = b.Business_City,
                    Business_State = b.Business_State,
                    Business_Full_Address = b.Business_Full_Address,
                    Business_Open = b.Business_Open
                })
                              .Where(b => (b.Business_City == model.City || model.City == null) &&
                                     (b.Business_State == model.State || model.State == null) &&
                                     (b.Category == model.Category || model.Category == null))
                              .OrderBy(bcat => bcat.Business_Name);

                var pageIndex = model.Page ?? 1;
                model.SearchResults = results.AsEnumerable().Distinct(new BusinessCategoryViewComparer()).ToPagedList(pageIndex, RecordsPerPage);
            }
            return(View(model));
        }
예제 #9
0
        public void fillcustom()
        {
            PropPurchase prpcustom = new PropPurchase();

            prpcustom.pName           = txtcustom.Text;
            dsop                      = BusinessSearch.buscustomsearch(prpcustom);
            PanelOrder.Visible        = false;
            PanResult.Visible         = false;
            Panelvendor.Visible       = false;
            PanelCat.Visible          = false;
            GridViewcustom.DataSource = dsop;
            PanelDate.Visible         = false;
            Panelcustom.Visible       = true;
            GridViewcustom.DataBind();
        }
예제 #10
0
        public void filldate()
        {
            PropPurchase prpDate = new PropPurchase();

            prpDate.date            = Convert.ToDateTime(txtSearchDate.Text);
            dsop                    = BusinessSearch.busSearchbyDate(prpDate);
            PanelOrder.Visible      = false;
            PanResult.Visible       = false;
            Panelvendor.Visible     = false;
            PanelCat.Visible        = false;
            GridViewdate.DataSource = dsop;
            Panelcustom.Visible     = false;
            PanelDate.Visible       = true;
            GridViewdate.DataBind();
        }
예제 #11
0
        public void fillorder()
        {
            PropPurchase prpPurchaseNo = new PropPurchase();

            prpPurchaseNo.PurchaseOr_No = txtSearchPurchaseOrNo.Text;
            dsop = BusinessSearch.busSearchbyPurchaseOrNo(prpPurchaseNo);
            PanelDate.Visible        = false;
            PanelCat.Visible         = false;
            Panelvendor.Visible      = false;
            PanResult.Visible        = false;
            Panelcustom.Visible      = false;
            GridVieworder.DataSource = dsop;
            PanelOrder.Visible       = true;
            GridVieworder.DataBind();
        }
예제 #12
0
        protected void ddlVendorName_SelectedIndexChanged(object sender, EventArgs e)
        {
            itemname = ddlVendorName.SelectedItem.Text;
            PropVendor prpven = new PropVendor();

            prpven.Name = itemname;
            dsop        = BusinessSearch.busConatctVendor(prpven);
            if (dsop.Tables[0].Rows.Count > 0)
            {
                Frmviwenquiries.DataSource = dsop;
                // grd.DataSource = dsop;
                Panop.Visible = true;
                // PanResult.Visible = true;
                Frmviwenquiries.DataBind();
            }
        }
예제 #13
0
        public void fillItem()
        {
            Itemname = ddlSearchItemName.SelectedItem.Text;
            PropItem prpItem = new PropItem();

            prpItem.Name              = Itemname;
            dsop                      = BusinessSearch.busSearchbyname(prpItem);
            PanelDate.Visible         = false;
            PanelOrder.Visible        = false;
            Panelvendor.Visible       = false;
            Panelcustom.Visible       = false;
            PanelCat.Visible          = false;
            grdvViewResult.DataSource = dsop;
            PanResult.Visible         = true;
            grdvViewResult.DataBind();
        }
예제 #14
0
        public void fillVendor()
        {
            PropVendor prpVendor = new PropVendor();

            vendorname     = ddlSearchVenderName.SelectedItem.Text;
            prpVendor.Name = vendorname;

            dsop = BusinessSearch.busSearchbyVendorName(prpVendor);
            PanelDate.Visible         = false;
            PanelOrder.Visible        = false;
            PanResult.Visible         = false;
            Panelcustom.Visible       = false;
            PanelCat.Visible          = false;
            GridViewvendor.DataSource = dsop;
            Panelvendor.Visible       = true;
            GridViewvendor.DataBind();
        }
예제 #15
0
        protected void btnSearchbyPurcahseOr_Click(object sender, EventArgs e)
        {
            PropPurchase obj = new PropPurchase();

            obj.pName                = ddlSearchItemName.SelectedItem.Text;
            obj.Destination_name     = ddlSitename.SelectedItem.Text;
            GridVieworder.DataSource = BusinessSearch.buscalculatefill(obj);
            DataSet ds = new DataSet();

            ds = BusinessSearch.buscalculatefill(obj);
            PanelOrder.Visible = true;
            GridVieworder.DataBind();

            if (ds.Tables[0].Rows.Count > 0)
            {
                bntcalculateResult.Visible = true;
            }
            else
            {
                bntcalculateResult.Visible = false;
                pnlResult.Visible          = false;
            }
        }
        public static void GetBusinesses(Action <NpgsqlDataReader> myf, BusinessSearch businessSearch)
        {
            string sqlStr = "SELECT DISTINCT Business.business_id, Business.business_name, Business.address, Business.city, Business.state, Business.zipcode, Business.longitude, Business.latitude, Business.stars, Business.numCheckins, Business.numTips, ";

            if (businessSearch.CurrentUser != null)
            {
                sqlStr += "Distance(" + businessSearch.CurrentUser.Latitude + ", " + businessSearch.CurrentUser.Longitude + ", Business.latitude, Business.longitude) AS distance ";
            }
            else
            {
                sqlStr += "-1 as distance ";
            }

            sqlStr += "FROM Business";
            int temp = 0;

            foreach (string category in businessSearch.BusinessCategories)
            {
                sqlStr += " JOIN Categories AS Category" + temp + " ON Category" + temp++ + ".business_id = Business.business_id";
            }

            temp = 0;
            foreach (string attribute in businessSearch.BusinessAttributes.Keys)
            {
                sqlStr += " JOIN BusinessAttributes AS Attributes" + temp + " ON Attributes" + temp++ + ".business_id = Business.business_id";
            }

            sqlStr += " WHERE Business.state = '" + businessSearch.State + "' AND Business.city = '" + businessSearch.City + "' AND Business.zipcode = '" + businessSearch.Zipcode + "'";

            temp = 0;
            foreach (string category in businessSearch.BusinessCategories)
            {
                sqlStr += " AND Category" + temp++ + ".category_name = '" + category + "'";
            }

            temp = 0;
            foreach (string attribute in businessSearch.BusinessAttributes.Keys)
            {
                sqlStr += " AND Attributes" + temp + ".attribute_name = '" + attribute + "' AND Attributes" + temp++ + ".value = '";

                string attributeValue = string.Empty;
                switch (attribute)
                {
                case "RestaurantsPriceRange2":
                    if (businessSearch.BusinessAttributes.TryGetValue(attribute, out attributeValue))
                    {
                        sqlStr += attributeValue;
                    }

                    break;

                case "WiFi":
                    sqlStr += "free";
                    break;

                default:
                    sqlStr += "True";
                    break;
                }

                sqlStr += "'";
            }

            sqlStr += " ORDER BY ";

            switch (businessSearch.SortingMethod)
            {
            case "Name (default)":
                sqlStr += "Business.business_name ASC";
                break;

            case "Highest Rating":
                sqlStr += "Business.stars DESC";
                break;

            case "Most Tips":
                sqlStr += "Business.numTips DESC";
                break;

            case "Most Check-ins":
                sqlStr += "Business.numCheckins DESC ";
                break;

            case "Nearest":
                if (businessSearch.CurrentUser != null)
                {
                    sqlStr += "distance ASC";
                }
                else
                {
                    sqlStr += "Business.business_name ASC";
                }

                break;
            }

            YelpDatabaseQueries.ExecuteQuery(sqlStr, myf);
        }