Exemple #1
0
        protected void dtlAdditionalInformation_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            var cboOrg      = e.Item.Controls[5] as DropDownList;
            int addonInfoId = Convert.ToInt16(e.Item.DataItem.GetPropertyValue("AddonInfoId"));



            //
            // When a item come to the reader, it automatically searchs the AdditionalInformationData
            // to fill the ComboBox with the related value.
            //

            //
            // Populate combos
            //
            cboOrg.Attributes["addonInfoId"] = addonInfoId.ToString();

            cboOrg.DataSource     = HumanResourcesManager.GetAdditionalInformationData(Company.CompanyId, addonInfoId);
            cboOrg.DataTextField  = "Name";
            cboOrg.DataValueField = "AddonInfoDataId";


            cboOrg.DataBind();

            if (employeeId != 0)
            {
                EmployeeAdditionalInformation addInfo = HumanResourcesManager.GetEmployeeAdditionalInformation(Company.CompanyId, addonInfoId, employeeId);

                if (addInfo != null)
                {
                    cboOrg.SelectedValue = addInfo.AddonInfoDataId.ToString();
                }
            }
        }
Exemple #2
0
        protected void lisAdditionalInformation_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            //
            // When a item come to the reader, it automatically searchs the AdditionalInformationData
            // to fill the ComboBox with the related value.
            //
            DropDownList          cboOrg   = e.Item.Controls[5] as DropDownList;
            HumanResourcesManager hManager = new HumanResourcesManager(this);

            cboOrg.DataSource     = hManager.GetAdditionalInformationData(Company.CompanyId, Convert.ToInt32((e.Item.Controls[1] as Label).Text));
            cboOrg.DataTextField  = "Name";
            cboOrg.DataValueField = "AddonInfoDataId";
            cboOrg.DataBind();
            //
            // If the form are in the update mode, the combobox will bind to the correct value, automatically
            //
            if (employeeId != null)
            {
                EmployeeAdditionalInformation addInfo = hManager.GetEmployeeAdditionalInformation
                                                        (
                    Company.CompanyId,
                    Convert.ToInt32((e.Item.Controls[1] as Label).Text),
                    employeeId
                                                        );
                if (addInfo != null)
                {
                    cboOrg.SelectedValue = addInfo.AddonInfoDataId.ToString();
                }
            }
        }