示例#1
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         placeID = -1;
         Session.Remove("PlaceID");
         countryID = -1;
         Session.Remove("CountryID");
         GridEditableItem item         = e.Item as GridEditableItem;
         RadDropDownList  ddlPlaces    = item.FindControl("ddlPlaces") as RadDropDownList;
         RadDropDownList  ddlCountries = item.FindControl("ddlCountries") as RadDropDownList;
         TextBox          txtNameGR    = (TextBox)item["NameGR"].Controls[0];
         txtNameGR.Width = Unit.Pixel(300);
         TextBox txtNameEN = (TextBox)item["NameEN"].Controls[0];
         txtNameEN.Width = Unit.Pixel(300);
         try {
             EventB currEvent          = e.Item.DataItem as EventB;
             CountriesController ccont = new CountriesController();
             PlacesController    cont  = new PlacesController();
             ddlCountries.DataSource     = ccont.GetCountries();
             ddlCountries.DataTextField  = "NameGR";
             ddlCountries.DataValueField = "ID";
             ddlCountries.DataBind();
             if (currEvent != null)
             {
                 ddlCountries.SelectedIndex = ddlCountries.FindItemByValue(currEvent.Place.CountryID.ToString()).Index;
                 Session["CountryID"]       = currEvent.Place.CountryID;
                 ddlPlaces.DataSource       = cont.GetPlaces().Where(k => k.CountryID == currEvent.Place.CountryID);
                 ddlPlaces.DataTextField    = "NameGR";
                 ddlPlaces.DataValueField   = "ID";
                 ddlPlaces.DataBind();
                 ddlPlaces.SelectedIndex = ddlPlaces.FindItemByValue(currEvent.PlaceID.ToString()).Index;
                 Session["PlaceID"]      = currEvent.PlaceID;
             }
             else
             {
                 ddlCountries.SelectedIndex = 0;
                 Session["CountryID"]       = ddlCountries.SelectedItem.Value;
                 ddlPlaces.DataSource       = cont.GetPlaces().Where(k => k.CountryID == int.Parse(ddlCountries.SelectedItem.Value));
                 ddlPlaces.DataTextField    = "NameGR";
                 ddlPlaces.DataValueField   = "ID";
                 ddlPlaces.DataBind();
                 ddlPlaces.SelectedIndex = 0;
                 Session["PlaceID"]      = ddlPlaces.SelectedItem.Value;
             }
         }
         catch (Exception) { }
     }
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            wizardData wData;

            if (!Page.IsPostBack)
            {
                pageTitle = ConfigurationManager.AppSettings["AppTitle"].ToString() + "Τιμολόγια > Δημιουργία Νέου Τιμολογίου";
                dpDateFrom.SelectedDate    = DateTime.Now.Date;
                dpDateTo.SelectedDate      = DateTime.Now.Date;
                dpDateCreated.SelectedDate = DateTime.Now.Date;
                dpDatePay.SelectedDate     = DateTime.Now.Date.AddDays(30);
                wData                 = new wizardData();
                wData.Step            = 1;
                Session["wizardStep"] = wData;
                showWizardSteps(wData);
                try {
                    CustomersController cont = new CustomersController();
                    ddlCustomers.DataSource     = cont.GetCustomersForCountry(1);
                    ddlCustomers.DataTextField  = "NameGR";
                    ddlCustomers.DataValueField = "ID";
                    ddlCustomers.DataBind();
                }
                catch (Exception) { }
            }
            if (Session["LoggedUser"] != null)
            {
                loggedUser = Session["LoggedUser"] as UserB;
            }
            else
            {
                Response.Redirect("/Default.aspx", true);
            }
        }
    protected void rgGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        try
        {
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
            {
                PuroTouchRepository       repository  = new PuroTouchRepository();
                UserControl               userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
                RadDropDownList           rddlService = userControl.FindControl("rddlService") as RadDropDownList;
                List <ClsShippingService> svclist     = repository.GetServices();
                rddlService.DataSource     = svclist;
                rddlService.DataTextField  = "serviceDesc";
                rddlService.DataValueField = "idShippingSvc";
                rddlService.DataBind();

                //Choose the right Shipping Service
                //GridEditFormItem editform = (GridEditFormItem)e.Item;


                string hiddenSvcID = (userControl.FindControl("hdServieID") as HiddenField).Value;
                rddlService.SelectedValue = hiddenSvcID;
            }
        }
        catch (Exception ex)
        {
            pnlDanger.Visible = true;
            lblDanger.Text    = ex.Message.ToString();
        }
    }
    protected void itemsGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem     = e.Item as GridDataItem;
            string       mat_code1    = dataItem["MAT_CODE1"].Text;
            string       MR_ITEM_NO   = dataItem["MR_ITEM_NO"].Text;
            string       mat_id       = WebTools.GetExpr("MAT_ID", "PIP_MAT_STOCK", " WHERE MAT_CODE1='" + mat_code1 + "'");
            string       heatno_query = "SELECT DISTINCT NVL(HEAT_NO,'NA') AS HEAT_NO FROM PRC_MAT_INSP_DETAIL WHERE MAT_ID=" + mat_id;
            string       drumno_query = " SELECT DISTINCT NVL(CABLE_DRUM_NO,'NA') AS CABLE_DRUM_NO   FROM (SELECT 1 AS SEQ, NVL(CABLE_DRUM_NO,'NA') AS CABLE_DRUM_NO FROM  MATERIAL_REQUEST_DETAIL WHERE MAT_REQ_ID=" + Request.QueryString["mat_req_id"] +
                                        "AND MR_ITEM_NO=" + MR_ITEM_NO + " UNION SELECT DISTINCT 2 AS SEQ,  NVL(CABLE_DRUM_NO,'NA') AS CABLE_DRUM_NO FROM PRC_MAT_INSP_DETAIL WHERE MAT_ID=" + mat_id +
                                        "ORDER BY seq ) ";



            HeatNoDataSource.SelectCommand = heatno_query;
            RadDropDownList ddlHn = ((dataItem["HEAT_NO"].FindControl("ddlHeatNo")) as RadDropDownList);
            ddlHn.DataSource = HeatNoDataSource;
            ddlHn.DataBind();
            DrumNoDataSource.SelectCommand = drumno_query;
            RadDropDownList ddlCN = ((dataItem["CABLE_DRUM_NO"].FindControl("ddlCableNo")) as RadDropDownList);
            ddlCN.DataSource = DrumNoDataSource;
            ddlCN.DataBind();
        }
    }
示例#5
0
 protected void ddlCountries_SelectedIndexChanged(object sender, DropDownListEventArgs e)
 {
     try {
         countryID            = int.Parse(e.Value);
         Session["CountryID"] = countryID;
         RadDropDownList  ddlCountries = (RadDropDownList)sender;
         GridEditableItem item         = (GridEditableItem)ddlCountries.NamingContainer;
         RadDropDownList  ddlPlaces    = (RadDropDownList)item.FindControl("ddlPlaces");
         ddlPlaces.ClearSelection();
         PlacesController cont = new PlacesController();
         ddlPlaces.DataSource     = cont.GetPlaces().Where(k => k.CountryID == countryID);
         ddlPlaces.DataTextField  = "NameGR";
         ddlPlaces.DataValueField = "ID";
         ddlPlaces.DataBind();
         ddlPlaces.SelectedIndex = 0;
         if (ddlPlaces.Items.Count > 0)
         {
             Session["PlaceID"] = ddlPlaces.SelectedItem.Value;
         }
         else
         {
             Session.Remove("PlaceID");
         }
     }
     catch (Exception) { }
 }
        public static void BindBuckets(RadDropDownList dd_Projects, RadDropDownList dd_Buckets, String BucketID, bool SelectCurrentlyViewed, bool ShowOnlyInactiveBuckets = false, bool OnlyCountContactsWithEmail = false)
        {
            if (dd_Projects.Items.Count > 0 && dd_Projects.SelectedItem != null)
            {
                String OnlyWithEmailExpr = String.Empty;
                if (OnlyCountContactsWithEmail)
                {
                    OnlyWithEmailExpr = " AND (Email IS NOT NULL OR PersonalEmail IS NOT NULL)";
                }

                String SumLeadsExpr = "SUM(CASE WHEN l.Active=1" + OnlyWithEmailExpr + " THEN 1 ELSE 0 END)";
                if (ShowOnlyInactiveBuckets)
                {
                    SumLeadsExpr = "SUM(CASE WHEN l.Active=0" + OnlyWithEmailExpr + " THEN 1 ELSE 0 END)";
                }

                String qry = "SELECT p.ProjectID, CONCAT(Name,' (',IFNULL(" + SumLeadsExpr + ",0),CASE WHEN IFNULL(" + SumLeadsExpr + ",0)=1 THEN ' lead)' ELSE ' leads)' END) as 'Name' " +
                             "FROM dbl_project p LEFT JOIN dbl_lead l ON p.ProjectID = l.ProjectID LEFT JOIN db_contact c ON c.ContactID = l.ContactID " +
                             "WHERE p.Active=@active AND p.IsBucket=1 AND ParentProjectID=@project_id GROUP BY p.ProjectID ORDER BY Name";
                DataTable dt_buckets = SQL.SelectDataTable(qry,
                                                           new String[] { "@project_id", "@active" },
                                                           new Object[] { dd_Projects.SelectedItem.Value, !ShowOnlyInactiveBuckets });

                dd_Buckets.DataSource     = dt_buckets;
                dd_Buckets.DataTextField  = "Name";
                dd_Buckets.DataValueField = "ProjectID";
                dd_Buckets.DataBind();

                if (SelectCurrentlyViewed)
                {
                    LeadsUtil.SelectCurrentlyViewedProject(dd_Buckets, BucketID);
                }
            }
        }
示例#7
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         JobsMainID = -1;
         Session.Remove("JobsMainID");
         Session.Remove("Position1");
         Session.Remove("Position2");
         GridEditableItem   item         = e.Item as GridEditableItem;
         RadAutoCompleteBox txtPosition1 = item.FindControl("txtPosition1") as RadAutoCompleteBox;
         RadAutoCompleteBox txtPosition2 = item.FindControl("txtPosition2") as RadAutoCompleteBox;
         RadDropDownList    ddlJobsMain  = item.FindControl("ddlJobsMain") as RadDropDownList;
         RadDropDownList    ddlPosition1 = item.FindControl("ddlPosition1") as RadDropDownList;
         RadDropDownList    ddlPosition2 = item.FindControl("ddlPosition2") as RadDropDownList;
         try {
             DistanceB          currDistance = e.Item.DataItem as DistanceB;
             JobsMainController cont         = new JobsMainController();
             ddlJobsMain.DataSource     = cont.GetJobsMain();
             ddlJobsMain.DataTextField  = "Name";
             ddlJobsMain.DataValueField = "ID";
             ddlJobsMain.DataBind();
             DistancesController dcont   = new DistancesController();
             List <string>       distPos = dcont.GetDistinctPositions();
             ddlPosition1.DataSource = distPos;
             ddlPosition1.DataBind();
             ddlPosition2.DataSource = distPos;
             ddlPosition2.DataBind();
             if (currDistance != null)
             {
                 txtPosition1.Entries.Add(new AutoCompleteBoxEntry(currDistance.Position1, currDistance.Position1));
                 txtPosition2.Entries.Add(new AutoCompleteBoxEntry(currDistance.Position2, currDistance.Position2));
                 ddlJobsMain.SelectedIndex = ddlJobsMain.FindItemByValue(currDistance.JobsMainID.ToString()).Index;
                 Session["JobsMainID"]     = currDistance.JobsMainID;
                 Session["Position1"]      = currDistance.Position1;
                 Session["Position2"]      = currDistance.Position2;
             }
             else
             {
                 ddlJobsMain.SelectedIndex = 0;
                 Session["JobsMainID"]     = ddlJobsMain.SelectedItem.Value;
             }
         }
         catch (Exception) { }
     }
     if (e.Item is GridFilteringItem)
     {
         GridFilteringItem filterItem = (GridFilteringItem)e.Item;
         RadDropDownList   cflist     = (RadDropDownList)filterItem.FindControl("ddlJobsMainFilter");
         try {
             JobsMainController ccont = new JobsMainController();
             cflist.DataSource     = ccont.GetJobsMain();
             cflist.DataTextField  = "Name";
             cflist.DataValueField = "ID";
             cflist.DataBind();
             cflist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0"));
         }
         catch (Exception) { }
     }
 }
示例#8
0
 public void Load_DataSource_DropDownList(RadDropDownList _dropdownlist)
 {
     _dropdownlist.DataSource     = this.All.ToList();
     _dropdownlist.DataTextField  = "CTXHTen";
     _dropdownlist.DataValueField = "CTXHID";
     _dropdownlist.DataBind();
     _dropdownlist.SelectedIndex = 0;
 }
示例#9
0
 public void Load_DataSource_Not_Of_NhanVien_DropDownList(RadDropDownList _dropdownlist, int _nhanvienID)
 {
     _dropdownlist.DataSource     = this.CTXH_Not_Of_NhanVien(_nhanvienID).ToList();
     _dropdownlist.DataTextField  = "CTXHTen";
     _dropdownlist.DataValueField = "CTXHID";
     _dropdownlist.DataBind();
     _dropdownlist.SelectedIndex = 0;
 }
示例#10
0
        public void Load_DataSource_DropDownList(RadDropDownList _dropDownList)
        {
            EmployeeManagementEntities     db         = new EmployeeManagementEntities();
            IEnumerable <Models.ChuyenMon> chuyenMons = db.ChuyenMons;

            _dropDownList.DataSource     = chuyenMons.ToList();
            _dropDownList.DataTextField  = "CMTen";
            _dropDownList.DataValueField = "CMID";
            _dropDownList.DataBind();
            _dropDownList.SelectedIndex = 0;
        }
示例#11
0
        public void Load_DataSource_DropDownList(RadDropDownList _dropDownList)
        {
            EmployeeManagementEntities         db    = new EmployeeManagementEntities();
            IEnumerable <Models.QuanLyNhaNuoc> qlnns = db.QuanLyNhaNuocs;

            _dropDownList.DataSource     = qlnns.ToList();
            _dropDownList.DataTextField  = "QLNNTen";
            _dropDownList.DataValueField = "QLNNID";
            _dropDownList.DataBind();
            _dropDownList.SelectedIndex = 0;
        }
示例#12
0
        protected void rGridTeam_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            try
            {
                if (e.Item is GridEditFormInsertItem)
                {
                    GridEditFormInsertItem dataItem = e.Item as GridEditFormInsertItem;

                    RadDropDownList rDDUserName = (RadDropDownList)dataItem.FindControl("rDDUserName");
                    rDDUserName.DataSource     = aspUserBLL.ListAspUsers();
                    rDDUserName.DataValueField = "UserId";
                    rDDUserName.DataTextField  = "UserName";
                    rDDUserName.DataBind();
                }
                else if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                {
                    GridEditFormItem dataItem = e.Item as GridEditFormItem;

                    RadDropDownList rDDUserName = (RadDropDownList)dataItem.FindControl("rDDUserName");
                    rDDUserName.DataSource     = aspUserBLL.ListAspUsers();
                    rDDUserName.DataValueField = "UserId";
                    rDDUserName.DataTextField  = "UserName";
                    rDDUserName.DataBind();
                    rDDUserName.SelectedValue = DataBinder.Eval(dataItem.DataItem, "OwnerUserID").ToString();
                }
                else if (e.Item is GridDataItem)
                {
                    GridDataItem dataItem = e.Item as GridDataItem;

                    MembershipUser currentUser = Membership.GetUser();

                    if (!Roles.IsUserInRole(Page.User.Identity.Name, "CSBA_Admin"))
                    {
                        if (DataBinder.Eval(dataItem.DataItem, "OwnerUserID").ToString() != currentUser.ProviderUserKey.ToString())
                        {
                            ImageButton EditButton = (ImageButton)dataItem["EditCommandColumn"].Controls[0];
                            EditButton.Visible = false;
                            ImageButton deleteButton = (ImageButton)dataItem["Delete"].Controls[0];
                            deleteButton.Visible = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StackTrace st        = new StackTrace();
                StackFrame sf        = st.GetFrame(0);
                string     errMethod = sf.GetMethod().Name.ToString();                                           // Get the current method name
                string     errMsg    = "600";                                                                    // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                                                                   // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                                                                          // Go to the error page.
            }
        }
示例#13
0
        // LOAD DATASOURCE
        public void Load_DataSource_DropDownList(RadDropDownList _dropDownList)
        {
            EmployeeManagementEntities   db  = new EmployeeManagementEntities();
            IEnumerable <Models.NhomMau> nms = db.NhomMaus;

            _dropDownList.DataSource     = nms.ToList();
            _dropDownList.DataTextField  = "NMTen";
            _dropDownList.DataValueField = "NMID";
            _dropDownList.DataBind();
            _dropDownList.SelectedIndex = 0;
        }
        public void Load_DataSource_DropDownList(RadDropDownList _dropdownlist)
        {
            EmployeeManagementEntities          db    = new EmployeeManagementEntities();
            IEnumerable <Models.LyLuanChinhTri> llcts = db.LyLuanChinhTris;

            _dropdownlist.DataSource     = llcts.ToList();
            _dropdownlist.DataTextField  = "LLCTTen";
            _dropdownlist.DataValueField = "LLCTID";
            _dropdownlist.DataBind();
            _dropdownlist.SelectedIndex = 0;
        }
示例#15
0
        public void Load_DataSource_DropDownList(RadDropDownList _dropDownList)
        {
            EmployeeManagementEntities           db    = new EmployeeManagementEntities();
            IEnumerable <Models.GiaoDucPhoThong> gdpts = db.GiaoDucPhoThongs;

            _dropDownList.DataSource     = gdpts.ToList();
            _dropDownList.DataTextField  = "GDPTTen";
            _dropDownList.DataValueField = "GDPTID";
            _dropDownList.DataBind();
            _dropDownList.SelectedIndex = 0;
        }
示例#16
0
        public static void PopulateAllowedBranches(BranchProvider branchProvider, RadDropDownList dropdown, string userName, bool addEmptyOption = false)
        {
            dropdown.DataSource     = branchProvider.GetAllowedBranches(userName);
            dropdown.DataTextField  = "Name";
            dropdown.DataValueField = "ID";
            dropdown.DataBind();

            if (addEmptyOption)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
示例#17
0
        public static void BindDropDown(RadDropDownList dropdown, IEnumerable enumerable, string dataTextField, string dataValueField, bool addFirstEmptyItem = false)
        {
            dropdown.DataSource     = enumerable;
            dropdown.DataTextField  = dataTextField;
            dropdown.DataValueField = dataValueField;
            dropdown.DataBind();

            if (addFirstEmptyItem)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
示例#18
0
        public static void PopulatePackages(PackageProvider packageProvider, RadDropDownList dropdown, bool addEmptyOption = false)
        {
            dropdown.DataSource     = packageProvider.GetAll();
            dropdown.DataTextField  = "Name";
            dropdown.DataValueField = "ID";
            dropdown.DataBind();

            if (addEmptyOption)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
示例#19
0
        public static void PopulateBillingTypes(BillingTypeProvider billingTypeProvider, RadDropDownList dropdown, bool addEmptyOption = false)
        {
            dropdown.DataSource     = billingTypeProvider.GetActiveBillingTypes();
            dropdown.DataTextField  = "Description";
            dropdown.DataValueField = "ID";
            dropdown.DataBind();

            if (addEmptyOption)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
示例#20
0
        public static void PopulateCustomerStatus(CustomerStatusProvider customerStatusProvider, RadDropDownList dropdown, bool addEmptyOption = false)
        {
            dropdown.DataSource     = customerStatusProvider.GetAll();
            dropdown.DataTextField  = "Description";
            dropdown.DataValueField = "ID";
            dropdown.DataBind();

            if (addEmptyOption)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
示例#21
0
        public static void PopulatePaidClasses(ClassProvider classProvider, RadDropDownList dropdown, bool addEmptyOption = false)
        {
            dropdown.DataSource     = classProvider.GetAllClasses().Where(cls => cls.IsPaid);
            dropdown.DataTextField  = "Name";
            dropdown.DataValueField = "ID";
            dropdown.DataBind();

            if (addEmptyOption)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
示例#22
0
    public static void PopulateActiveBranches(RadDropDownList dropdown, string userName, bool addEmptyOption = false)
    {
        BranchProvider branchProvider = UnityContainerHelper.Container.Resolve <BranchProvider>();

        dropdown.DataSource     = branchProvider.GetActiveBranches(userName);
        dropdown.DataTextField  = "Name";
        dropdown.DataValueField = "ID";
        dropdown.DataBind();

        if (addEmptyOption)
        {
            dropdown.Items.Insert(0, new DropDownListItem(String.Empty, String.Empty));
        }
    }
示例#23
0
        protected void rgHospitals_ItemDataBound(object source, GridItemEventArgs e)
        {
            if (e.Item.IsInEditMode)
            {
                GridEditableItem item = (GridEditableItem)e.Item;

                RadDropDownList ddlHospitals = (RadDropDownList)item.FindControl("ddlHospitals");
                ddlHospitals.DataSource = db.Hospitals.Where(p => p.wsc_id == currSHA.Site.Office.wsc_id).ToList();
                ddlHospitals.DataBind();

                HyperLink hlEmergInfoLink = (HyperLink)item.FindControl("hlEmergInfo3");
                hlEmergInfoLink.NavigateUrl = EmergInfoLink;
            }
        }
示例#24
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         newID = -1;
         Session.Remove("CountryID");
         GridEditableItem item      = e.Item as GridEditableItem;
         TextBox          txtNameGR = (TextBox)item["NameGR"].Controls[0];
         txtNameGR.Width = Unit.Pixel(300);
         TextBox txtNameEN = (TextBox)item["NameEN"].Controls[0];
         txtNameEN.Width = Unit.Pixel(300);
         RadDropDownList list = item.FindControl("ddlCountries") as RadDropDownList;
         try {
             PlaceB currPlace         = e.Item.DataItem as PlaceB;
             CountriesController cont = new CountriesController();
             list.DataSource     = cont.GetCountries();
             list.DataTextField  = "NameGR";
             list.DataValueField = "ID";
             list.DataBind();
             if (currPlace != null)
             {
                 list.SelectedIndex   = list.FindItemByValue(currPlace.CountryID.ToString()).Index;
                 Session["CountryID"] = currPlace.CountryID;
             }
             else
             {
                 list.SelectedIndex   = 0;
                 Session["CountryID"] = list.SelectedItem.Value;
             }
         }
         catch (Exception) { }
     }
     if (e.Item is GridFilteringItem)
     {
         GridFilteringItem filterItem = (GridFilteringItem)e.Item;
         RadDropDownList   cflist     = (RadDropDownList)filterItem.FindControl("ddlCountryFilter");
         try {
             CountriesController ccont = new CountriesController();
             cflist.DataSource     = ccont.GetCountries();
             cflist.DataTextField  = "NameGR";
             cflist.DataValueField = "ID";
             cflist.DataBind();
             cflist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0"));
         }
         catch (Exception) { }
     }
 }
示例#25
0
        protected void rgSANAL_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.IsInEditMode)
            {
                GridEditableItem item = (GridEditableItem)e.Item;

                int period_id = Convert.ToInt32(item.GetDataKeyValue("period_id"));
                var period    = db.RecordAnalysisPeriods.FirstOrDefault(p => p.period_id == period_id);

                RadDropDownList rddlAnalyzedBy = (RadDropDownList)item.FindControl("rddlAnalyzedBy");
                RadDatePicker   rdpAnalyzedDt  = (RadDatePicker)item.FindControl("rdpAnalyzedDt");
                RadDropDownList rddlApprovedBy = (RadDropDownList)item.FindControl("rddlApprovedBy");
                RadDatePicker   rdpApprovedDt  = (RadDatePicker)item.FindControl("rdpApprovedDt");
                RadEditor       reSANAL        = (RadEditor)item.FindControl("reSANAL");

                //Analyzer & Approver
                var personnel = db.SP_Personnel_by_WSC_office_or_user_id(period.Record.Site.Office.wsc_id, 0, "", "no", "All", "no");
                rddlAnalyzedBy.DataSource = personnel;
                rddlAnalyzedBy.DataBind();
                rddlApprovedBy.DataSource = personnel;
                rddlApprovedBy.DataBind();
                if (!string.IsNullOrEmpty(period.analyzed_by))
                {
                    rddlAnalyzedBy.SelectedValue = period.analyzed_by;
                    rdpAnalyzedDt.SelectedDate   = period.analyzed_dt;
                }
                else
                {
                    rddlAnalyzedBy.Items.Insert(0, new DropDownListItem {
                        Value = "", Text = ""
                    });
                }
                if (!string.IsNullOrEmpty(period.approved_by))
                {
                    rddlApprovedBy.SelectedValue = period.approved_by;
                    rdpApprovedDt.SelectedDate   = period.approved_dt;
                }
                else
                {
                    rddlApprovedBy.Items.Insert(0, new DropDownListItem {
                        Value = "", Text = ""
                    });
                }

                reSANAL.Content = period.analysis_notes_va.FormatParagraphEdit();
            }
        }
示例#26
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridFilteringItem)
     {
         GridFilteringItem filterItem = (GridFilteringItem)e.Item;
         RadDropDownList   ctflist    = (RadDropDownList)filterItem.FindControl("ddlCustomerFilter");
         try {
             CustomersController ctcont = new CustomersController();
             ctflist.DataSource     = ctcont.GetAllCustomers();
             ctflist.DataTextField  = "NameGR";
             ctflist.DataValueField = "ID";
             ctflist.DataBind();
             ctflist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0"));
         }
         catch (Exception) { }
     }
 }
示例#27
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item.OwnerTableView.Name == "Master")
     {
         if (e.Item is GridEditableItem && e.Item.IsInEditMode)
         {
             SalesType = -1;
             Session.Remove("SalesType");
             GridEditableItem item = e.Item as GridEditableItem;
             try {
                 SaleB           currSale = e.Item.DataItem as SaleB;
                 RadDropDownList list     = item.FindControl("ddlSaleType") as RadDropDownList;
                 list.Items.Clear();
                 list.Items.Add(new DropDownListItem("Κλιμακωτά", "1"));
                 list.Items.Add(new DropDownListItem("Σε όλο το ποσό", "2"));
                 list.DataBind();
                 if (currSale != null)
                 {
                     list.SelectedIndex   = list.FindItemByValue(currSale.Type.ToString()).Index;
                     Session["SalesType"] = currSale.Type;
                 }
                 else
                 {
                     list.SelectedIndex   = 0;
                     Session["SalesType"] = list.SelectedItem.Value;
                 }
             }
             catch (Exception) { }
         }
         else if (e.Item is GridDataItem)
         {
             GridDataItem item     = e.Item as GridDataItem;
             Label        lblST    = item.FindControl("lblSaleType") as Label;
             SaleB        currSale = e.Item.DataItem as SaleB;
             if (currSale.Type == 1)
             {
                 lblST.Text = "Κλιμακωτά";
             }
             else if (currSale.Type == 2)
             {
                 lblST.Text = "Σε όλο το ποσό";
             }
         }
     }
 }
示例#28
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         newID = -1;
         Session.Remove("UserGroupID");
         GridEditableItem item = e.Item as GridEditableItem;
         RadDropDownList  list = item.FindControl("ddlUserGroups") as RadDropDownList;
         try {
             UserB currUser            = e.Item.DataItem as UserB;
             UserGroupsController cont = new UserGroupsController();
             list.DataSource     = cont.GetUserGroups();
             list.DataTextField  = "Name";
             list.DataValueField = "ID";
             list.DataBind();
             if (currUser != null)
             {
                 list.SelectedIndex     = list.FindItemByValue(currUser.UserGroupID.ToString()).Index;
                 Session["UserGroupID"] = currUser.UserGroupID;
             }
             else
             {
                 list.SelectedIndex     = 0;
                 Session["UserGroupID"] = list.SelectedItem.Value;
             }
         }
         catch (Exception) { }
     }
     if (e.Item is GridFilteringItem)
     {
         GridFilteringItem filterItem = (GridFilteringItem)e.Item;
         RadDropDownList   flist      = (RadDropDownList)filterItem.FindControl("ddlUserGroupsFilter");
         try {
             UserGroupsController cont = new UserGroupsController();
             flist.DataSource     = cont.GetUserGroups();
             flist.DataTextField  = "Name";
             flist.DataValueField = "ID";
             flist.DataBind();
             flist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0"));
         }
         catch (Exception) { }                                                                        //combo.Items.Add(new RadComboBoxItem("New"));
     }
 }
    private void BindCountryDropDown(RadDropDownList dd_country, bool IncludeBlankSelection, String Country = "")
    {
        String    qry = "SELECT countryid, country, phonecode FROM dbd_country ORDER BY country";
        DataTable dt  = SQL.SelectDataTable(qry, null, null);

        dd_country.DataSource     = dt;
        dd_country.DataValueField = "countryid";
        dd_country.DataTextField  = "country";
        dd_country.DataBind();
        if (IncludeBlankSelection)
        {
            dd_country.Items.Insert(0, new DropDownListItem(String.Empty, String.Empty));
        }

        if (Country != "" && dd_country.FindItemByText(Country) != null)
        {
            dd_country.SelectedIndex = dd_country.FindItemByText(Country).Index;
        }
    }
示例#30
0
 protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         CustomerID = -1;
         Session.Remove("CustomerID");
         LineTypeID = -1;
         Session.Remove("LineTypeID");
         GridEditableItem item        = e.Item as GridEditableItem;
         RadDropDownList  ddlCustomer = item.FindControl("ddlCustomer") as RadDropDownList;
         RadDropDownList  ddlLineType = item.FindControl("ddlLineType") as RadDropDownList;
         try {
             CountryPricelistB   currPricelist = e.Item.DataItem as CountryPricelistB;
             CustomersController cont          = new CustomersController();
             ddlCustomer.DataSource     = cont.GetProviders();
             ddlCustomer.DataTextField  = "NameGR";
             ddlCustomer.DataValueField = "ID";
             ddlCustomer.DataBind();
             LineTypesController cont2 = new LineTypesController();
             ddlLineType.DataSource     = cont2.GetLineTypes();
             ddlLineType.DataTextField  = "Name";
             ddlLineType.DataValueField = "ID";
             ddlLineType.DataBind();
             if (currPricelist != null)
             {
                 ddlCustomer.SelectedIndex = ddlCustomer.FindItemByValue(currPricelist.CustomerID.ToString()).Index;
                 Session["CustomerID"]     = currPricelist.CustomerID;
                 ddlLineType.SelectedIndex = ddlLineType.FindItemByValue(currPricelist.LineTypeID.ToString()).Index;
                 Session["LineTypeID"]     = currPricelist.LineTypeID;
             }
             else
             {
                 ddlCustomer.SelectedIndex = 0;
                 Session["CustomerID"]     = ddlCustomer.SelectedItem.Value;
                 ddlLineType.SelectedIndex = 0;
                 Session["LineTypeID"]     = ddlLineType.SelectedItem.Value;
             }
         }
         catch (Exception) { }
     }
 }
        /// <summary>
        /// Permite llenar un DropDownList a partir de una Datatable con los datos
        /// </summary>
        /// <param name="dtDatos">Objecto DataTable con los datos a cargar en el DropDownList</param>
        /// <param name="myDropDownList">Objeto DropDownList que se llena</param>
        /// <remarks>
        /// <list>Creado: 25 de Noviembre de 2013 - Ing. David Pineda</list>
        /// </remarks>
        public static void llenarDropDownList(DataTable dtDatos, ref RadDropDownList myDropDownList)
        {
            if (dtDatos == null)
            {
                throw new ArgumentNullException("El argumento dtDatos es nulo");
            }

            if (myDropDownList == null)
            {
                throw new ArgumentNullException("El argumento myDropDownList es nulo");
            }

            try
            {
                myDropDownList.Items.Clear();
                myDropDownList.DataValueField = myDropDownList.DataValueField;
                myDropDownList.DataTextField = myDropDownList.DataTextField;
                myDropDownList.DataSource = dtDatos;
                myDropDownList.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }