Exemple #1
0
    public void FillVendorDataList(int SocietyID, String UserType)
    {
        try
        {
            VendorController vendorController = new VendorController();
            DataSet          DatasetVendors   = vendorController.GetVendors(muser.currentResident.SocietyID, muser.currentResident.UserType, 0);

            //String TotalvendorsQuery = "Select Count(ID) from dbo.vendors;";
            int Totalvendors = 0; //dacess.GetSingleValue(TotalvendorsQuery);

            if (DatasetVendors == null || DatasetVendors.Tables == null || DatasetVendors.Tables.Count == 0 ||
                DatasetVendors.Tables[0].Rows.Count == 0)
            {
                drpvendorfilter.Visible = false;
                //lblVendrCatText.Visible = false;
                lblVendrEmptyText.Text = "At this  time  there are  no  Vendors registered in this society";
            }

            else
            {
                drpVendorcategory.Visible = true;
                //lblVendrCatText.Visible = true;
                DataTable dt = DatasetVendors.Tables[0];
                Datavendors.DataSource = dt;

                Datavendors.DataBind();
                Totalvendors = dt.Rows.Count;
                //if (dt.Rows.Count > 0)
                //{
                //    if (dt.Rows.Count == 2)
                //    {
                //        Datavendors.Width = new Unit("100%");
                //    }

                //    if (dt.Rows.Count == 1)
                //    {
                //        Datavendors.Width = new Unit("100%");
                //    }
                //    Datavendors.DataSource = dt;
                //    Datavendors.DataBind();
                //    Totalvendors = dt.Rows.Count;
                //}
                lblTotalVendors.Text = Totalvendors.ToString();
            }
        }

        catch (Exception ex)
        {
        }
    }
Exemple #2
0
        static void Main(string[] args)
        {
            var _context = new PRSContext();
            var users    = _context.User.ToList();
            var user1    = _context.User.Find(1);

            user1.PhoneNumber = "513-555-1212";
            _context.SaveChanges();
            var control       = new UsersController(_context);
            var user          = control.Login("Steve", "SteveSteve");
            var user2         = control.Login("Stevebob", "SteveSteve");
            var ReqCtrl       = new RequestsController(_context);
            var changeApprove = ReqCtrl.SetToApprove(_context.Request.Find(1));
            var VendorCtrl    = new VendorController(_context);
            var vendorList    = VendorCtrl.GetVendors();
        }
Exemple #3
0
        private void SetDataSource()
        {
            CreateLetterSearch();

            bool isUnauthorized = false;

            if (_searchFilter == Localization.GetString("All"))
            {
                _searchFilter = "";
            }
            else if (_searchFilter == Localization.GetString("Unauthorized"))
            {
                _searchFilter  = "";
                isUnauthorized = true;
            }

            //Get the list of vendors from the database
            var totalRecords     = 0;
            var vendorController = new VendorController();
            int portal           = Globals.IsHostTab(PortalSettings.ActiveTab.TabID) ? Null.NullInteger : PortalId;

            if (String.IsNullOrEmpty(_searchFilter))
            {
                grdVendors.DataSource       = vendorController.GetVendors(portal, isUnauthorized, grdVendors.CurrentPageIndex, grdVendors.PageSize, ref totalRecords);
                grdVendors.VirtualItemCount = totalRecords;
            }
            else
            {
                if (_searchField == "email")
                {
                    grdVendors.DataSource       = vendorController.GetVendorsByEmail(_searchFilter, portal, grdVendors.CurrentPageIndex, grdVendors.PageSize, ref totalRecords);
                    grdVendors.VirtualItemCount = totalRecords;
                }
                else
                {
                    grdVendors.DataSource       = vendorController.GetVendorsByName(_searchFilter, portal, grdVendors.CurrentPageIndex, grdVendors.PageSize, ref totalRecords);
                    grdVendors.VirtualItemCount = totalRecords;
                }
            }
        }
Exemple #4
0
        private void BindData(string searchText, string searchField)
        {
            CreateLetterSearch();

            //Localize the Headers
            Localization.LocalizeDataGrid(ref grdVendors, LocalResourceFile);

            if (searchText == Localization.GetString("All"))
            {
                strFilter = "";
            }
            else if (searchText == Localization.GetString("Unauthorized"))
            {
                strFilter = "";
            }
            else
            {
                strFilter = searchText;
            }

            //Get the list of vendors from the database
            var PageSize     = Convert.ToInt32(ddlRecordsPerPage.SelectedItem.Value);
            var TotalRecords = 0;
            var objVendors   = new VendorController();
            int Portal       = Globals.IsHostTab(PortalSettings.ActiveTab.TabID) ? Null.NullInteger : PortalId;

            if (String.IsNullOrEmpty(strFilter))
            {
                if (searchText == Localization.GetString("Unauthorized"))
                {
                    grdVendors.DataSource = objVendors.GetVendors(Portal, true, CurrentPage - 1, PageSize, ref TotalRecords);
                }
                else
                {
                    grdVendors.DataSource = objVendors.GetVendors(Portal, false, CurrentPage - 1, PageSize, ref TotalRecords);
                }
            }
            else
            {
                if (searchField == "email")
                {
                    grdVendors.DataSource = objVendors.GetVendorsByEmail(strFilter, Portal, CurrentPage - 1, PageSize, ref TotalRecords);
                }
                else
                {
                    grdVendors.DataSource = objVendors.GetVendorsByName(strFilter, Portal, CurrentPage - 1, PageSize, ref TotalRecords);
                }
            }
            grdVendors.DataBind();

            ctlPagingControl.TotalRecords = TotalRecords;
            ctlPagingControl.PageSize     = PageSize;
            ctlPagingControl.CurrentPage  = CurrentPage;
            string strQuerystring = "";

            if (ddlRecordsPerPage.SelectedIndex != 0)
            {
                strQuerystring = "PageRecords=" + ddlRecordsPerPage.SelectedValue;
            }
            if (!String.IsNullOrEmpty(strFilter))
            {
                strQuerystring += "&filter=" + strFilter;
            }
            ctlPagingControl.QuerystringParams = strQuerystring;
            ctlPagingControl.TabID             = TabId;
        }
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    // Obtain banner information from the Banners table and bind to the list control
                    BannerTypeController objBannerTypes = new BannerTypeController();

                    cboType.DataSource = objBannerTypes.GetBannerTypes();
                    cboType.DataBind();
                    cboType.Items.Insert(0, new ListItem(Localization.GetString("AllTypes", LocalResourceFile), "-1"));

                    ArrayList        lstVendors;
                    VendorController objVendor = new VendorController();
                    lstVendors               = objVendor.GetVendors(PortalId, "");
                    ddlVendor.DataSource     = lstVendors;
                    ddlVendor.DataTextField  = "VendorName";
                    ddlVendor.DataValueField = "VendorId";
                    ddlVendor.DataBind();
                    ddlVendor.Items.Insert(0, new ListItem("", "0"));

                    if (ModuleId > 0)
                    {
                        // Get settings from the database
                        Hashtable settings = PortalSettings.GetModuleSettings(ModuleId);

                        if (optSource.Items.FindByValue(Convert.ToString(settings["bannersource"])) != null)
                        {
                            optSource.Items.FindByValue(Convert.ToString(settings["bannersource"])).Selected = true;
                        }
                        else
                        {
                            optSource.Items.FindByValue("L").Selected = true;
                        }

                        if (cboType.Items.FindByValue(Convert.ToString(settings["bannertype"])) != null)
                        {
                            cboType.Items.FindByValue(Convert.ToString(settings["bannertype"])).Selected = true;
                        }
                        if (ddlVendor.Items.FindByValue(Convert.ToString(settings["vendor"])) != null)
                        {
                            ddlVendor.Items.FindByValue(Convert.ToString(settings["vendor"])).Selected = true;
                        }
                        if (optOrientation.Items.FindByValue(Convert.ToString(settings["orientation"])) != null)
                        {
                            optOrientation.Items.FindByValue(Convert.ToString(settings["orientation"])).Selected = true;
                        }
                        else
                        {
                            optOrientation.Items.FindByValue("V").Selected = true;
                        }
                        if (Convert.ToString(settings["bannercount"]) != "")
                        {
                            txtCount.Text = Convert.ToString(settings["bannercount"]);
                        }
                        else
                        {
                            txtCount.Text = "1";
                        }
                        if (Convert.ToString(settings["border"]) != "")
                        {
                            txtBorder.Text = Convert.ToString(settings["border"]);
                        }
                        else
                        {
                            txtBorder.Text = "0";
                        }
                        if (Convert.ToString(settings["padding"]) != "")
                        {
                            txtPadding.Text = Convert.ToString(settings["padding"]);
                        }
                        else
                        {
                            txtPadding.Text = "4";
                        }
                        txtBorderColor.Text = Convert.ToString(settings["bordercolor"]);
                        txtRowHeight.Text   = Convert.ToString(settings["rowheight"]);
                        txtColWidth.Text    = Convert.ToString(settings["colwidth"]);
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }