public void InsertComboValue_Test()
 {
     busReservedFied.InsertComboItem(ADORsvField1.ID, "TestComboTitle2", "TestComboValue");
     ClearSession();
     prsRsvField_testObject = busReservedFied.GetByID(ADORsvField1.ID);
     Assert.AreEqual(1, prsRsvField_testObject.ComboItems.Count);
 }
    private void Fill_GridReserveFieldItems_PersonnelExtraInformationSettings(decimal ReserveFieldID)
    {
        string[] retMessage = new string[4];

        this.InitializeCulture();

        try
        {
            PersonReserveField personnelReserveField = this.PersonnelReservedFieldBusiness.GetByID(ReserveFieldID);
            IList <PersonReserveFieldComboValue> PersonnelReserveFieldItemsList = personnelReserveField.ComboItems;
            this.GridReserveFieldItems_PersonnelExtraInformationSettings.DataSource = PersonnelReserveFieldItemsList;
            this.GridReserveFieldItems_PersonnelExtraInformationSettings.DataBind();
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_ReserveFieldItems_PersonnelExtraInformationSettings.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_ReserveFieldItems_PersonnelExtraInformationSettings.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_ReserveFieldItems_PersonnelExtraInformationSettings.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
 public void UpdateReservedFiles_LableEmpty_Test()
 {
     busReservedFied.UpdateReservedFieldLable(ADORsvField1.ID, "updated Lable Test");
     ClearSession();
     prsRsvField_testObject = busReservedFied.GetByID(ADORsvField1.ID);
     Assert.AreEqual("updated Lable Test", prsRsvField_testObject.Lable);
 }
        public void TestSetup()
        {
            busReservedFied        = new BPersonReservedField();
            prsRsvField_testObject = new PersonReserveField();

            prsRsvTA.Insert((decimal)prsRsvTA.GetMaxID() + 1000, "TestPrsRsvField", "TestLable1", 2);
            DatabaseGateway2.TA_PersonReserveFieldDataTable table =
                prsRsvTA.GetDataByOrginName("TestPrsRsvField");
            ADORsvField1.ID = ((DatabaseGateway2.TA_PersonReserveFieldRow)table.Rows[0]).ReserveField_ID;
        }
        public void DeleteComboValue_Test()
        {
            busReservedFied.InsertComboItem(ADORsvField1.ID, "TestComboTitle2", "TestComboValue");
            ClearSession();
            prsRsvField_testObject = busReservedFied.GetByID(ADORsvField1.ID);
            decimal combiId = prsRsvField_testObject.ComboItems.First().ID;

            ClearSession();
            busReservedFied.DeleteComboItem(ADORsvField1.ID, combiId);
            ClearSession();
            prsRsvField_testObject = busReservedFied.GetByID(ADORsvField1.ID);
            Assert.AreEqual(0, prsRsvField_testObject.ComboItems.Count);
        }
        public void EditComboValue_Test()
        {
            busReservedFied.InsertComboItem(ADORsvField1.ID, "TestComboTitle", "TestComboValue");
            ClearSession();
            prsRsvField_testObject = busReservedFied.GetByID(ADORsvField1.ID);
            PersonReserveFieldComboValue combo = prsRsvField_testObject.ComboItems.First();

            ClearSession();
            busReservedFied.EditComboItem(ADORsvField1.ID, combo.ID, "TestComboTitle1", "TestComboValue1");
            ClearSession();
            prsRsvField_testObject = busReservedFied.GetByID(ADORsvField1.ID);
            combo = prsRsvField_testObject.ComboItems.First();
            Assert.AreEqual("TestComboTitle1", combo.ComboText);
            Assert.AreEqual("TestComboValue1", combo.ComboValue);
        }
        private DesignedReportColumnProxy ConvertDesignedReportColumnToProxy(DesignedReportColumn designedReportColumn)
        {
            try
            {
                DesignedReportColumnProxy designedReportColumnProxy = new DesignedReportColumnProxy();
                designedReportColumnProxy.Active = designedReportColumn.Active;

                if (designedReportColumn.Concept != null)
                {
                    switch (BLanguage.CurrentLocalLanguage)
                    {
                    case LanguagesName.Parsi:
                        designedReportColumnProxy.Name = designedReportColumn.Concept.FnName;
                        break;

                    case LanguagesName.English:
                        designedReportColumnProxy.Name = designedReportColumn.Concept.EnName;
                        break;

                    default:
                        designedReportColumnProxy.Name = designedReportColumn.Concept.FnName;
                        break;
                    }
                    designedReportColumnProxy.ConceptID  = designedReportColumn.Concept.ID;
                    designedReportColumnProxy.ColumnName = designedReportColumn.Concept.KeyColumnName;
                    designedReportColumnProxy.ColumnType = DesignedReportColumnType.Concept.ToString();
                }
                if (designedReportColumn.PersonInfo != null)
                {
                    IList <PersonReserveField> personReserveFieldList = new List <PersonReserveField>();
                    if (designedReportColumn.PersonInfo.IsReserveField)
                    {
                        personReserveFieldList = new BPersonReservedField().GetAll();
                    }
                    if (designedReportColumn.PersonInfo.IsReserveField)
                    {
                        string             itemKey = designedReportColumn.PersonInfo.Key.ToString().Replace("prsTA_", "");
                        PersonReserveField personReserveFieldObj = personReserveFieldList.FirstOrDefault(r => r.OrginalName.ToLower().Trim() == itemKey.ToLower().Trim());
                        if (personReserveFieldObj != null)
                        {
                            designedReportColumnProxy.Name = personReserveFieldObj.Lable;
                        }
                        else
                        {
                            switch (BLanguage.CurrentLocalLanguage)
                            {
                            case LanguagesName.Parsi:
                                designedReportColumnProxy.Name = designedReportColumn.PersonInfo.FnName;
                                break;

                            case LanguagesName.English:
                                designedReportColumnProxy.Name = designedReportColumn.PersonInfo.EnName;
                                break;

                            default:
                                designedReportColumnProxy.Name = designedReportColumn.PersonInfo.FnName;
                                break;
                            }
                        }
                    }
                    else
                    {
                        switch (BLanguage.CurrentLocalLanguage)
                        {
                        case LanguagesName.Parsi:
                            designedReportColumnProxy.Name = designedReportColumn.PersonInfo.FnName;
                            break;

                        case LanguagesName.English:
                            designedReportColumnProxy.Name = designedReportColumn.PersonInfo.EnName;
                            break;

                        default:
                            designedReportColumnProxy.Name = designedReportColumn.PersonInfo.FnName;
                            break;
                        }
                    }

                    designedReportColumnProxy.PersonInfoID = designedReportColumn.PersonInfo.ID;
                    designedReportColumnProxy.ColumnName   = new BReport().GetDesignedReportColumnFieldNameForDesigned(designedReportColumn);
                    designedReportColumnProxy.ColumnType   = DesignedReportColumnType.PersonInfo.ToString();
                }
                if (designedReportColumn.Traffic != null)
                {
                    switch (BLanguage.CurrentLocalLanguage)
                    {
                    case LanguagesName.Parsi:
                        designedReportColumnProxy.Name = designedReportColumn.Traffic.FnName;
                        break;

                    case LanguagesName.English:
                        designedReportColumnProxy.Name = designedReportColumn.Traffic.EnName;
                        break;

                    default:
                        designedReportColumnProxy.Name = designedReportColumn.Traffic.FnName;
                        break;
                    }

                    designedReportColumnProxy.TrafficID          = designedReportColumn.Traffic.ID;
                    designedReportColumnProxy.ColumnName         = designedReportColumn.Traffic.Key.ToString();
                    designedReportColumnProxy.ColumnType         = DesignedReportColumnType.Traffic.ToString();
                    designedReportColumnProxy.TrafficColumnCount = designedReportColumn.TrafficColumnCount.ToString();
                }
                if (designedReportColumn.PersonParam != null)
                {
                    switch (BLanguage.CurrentLocalLanguage)
                    {
                    case LanguagesName.Parsi:
                        designedReportColumnProxy.Name = designedReportColumn.PersonParam.FnTitle;
                        break;

                    case LanguagesName.English:
                        designedReportColumnProxy.Name = designedReportColumn.PersonParam.EnTitle;
                        break;

                    default:
                        designedReportColumnProxy.Name = designedReportColumn.PersonParam.FnTitle;
                        break;
                    }
                    designedReportColumnProxy.PersonParamID = designedReportColumn.PersonParam.ID;
                    designedReportColumnProxy.ColumnName    = new BReport().GetDesignedReportColumnFieldNameForDesigned(designedReportColumn);
                    designedReportColumnProxy.ColumnType    = DesignedReportColumnType.PersonParam.ToString();
                }
                designedReportColumnProxy.ID            = designedReportColumn.ID;
                designedReportColumnProxy.IsConcept     = designedReportColumn.IsConcept;
                designedReportColumnProxy.Order         = designedReportColumn.Order;
                designedReportColumnProxy.ReportID      = designedReportColumn.Report.ID;
                designedReportColumnProxy.Title         = designedReportColumn.Title;
                designedReportColumnProxy.IsGroupColumn = designedReportColumn.IsGroupColumn;

                return(designedReportColumnProxy);
            }
            catch (Exception ex)
            {
                LogException(ex, "BDesignedReportsColumn", "ConvertDesignedReportColumnToProxy");
                throw ex;
            }
        }
        public IList <DesignedColumnProxy> GetAllDesignedReportsPersonInfoProxyColumns(decimal reportId)
        {
            try
            {
                IList <DesignedColumnProxy>            designedColumnProxyList            = new List <DesignedColumnProxy>();
                IList <DesignedReportPersonInfoColumn> designedReportPersonInfoColumnList = repDesignedReportPersonInfoColumn.GetAll().ToList <DesignedReportPersonInfoColumn>();
                IList <PersonReserveField>             personReserveFieldList             = new List <PersonReserveField>();
                if (designedReportPersonInfoColumnList.Count(d => d != null && d.IsReserveField) > 0)
                {
                    personReserveFieldList = new BPersonReservedField().GetAll();
                }

                foreach (DesignedReportPersonInfoColumn item in designedReportPersonInfoColumnList)
                {
                    DesignedColumnProxy columnProxy = new DesignedColumnProxy();
                    if (item.IsReserveField)
                    {
                        string             itemKey = item.Key.ToString().Replace("prsTA_", "");
                        PersonReserveField personReserveFieldObj = personReserveFieldList.FirstOrDefault(r => r.OrginalName.ToLower().Trim() == itemKey.ToLower().Trim());
                        if (personReserveFieldObj != null)
                        {
                            columnProxy.Name = personReserveFieldObj.Lable;
                        }
                        else
                        {
                            switch (BLanguage.CurrentLocalLanguage)
                            {
                            case LanguagesName.Parsi:
                                columnProxy.Name = item.FnName;
                                break;

                            case LanguagesName.English:
                                columnProxy.Name = item.EnName;
                                break;

                            default:
                                columnProxy.Name = item.FnName;
                                break;
                            }
                        }
                    }
                    else
                    {
                        switch (BLanguage.CurrentLocalLanguage)
                        {
                        case LanguagesName.Parsi:
                            columnProxy.Name = item.FnName;
                            break;

                        case LanguagesName.English:
                            columnProxy.Name = item.EnName;
                            break;

                        default:
                            columnProxy.Name = item.FnName;
                            break;
                        }
                    }
                    columnProxy.ColumnType = DesignedReportColumnType.PersonInfo;
                    columnProxy.ID         = item.ID;
                    columnProxy.KeyColumn  = item.Key.ToString();
                    designedColumnProxyList.Add(columnProxy);
                }
                designedColumnProxyList = designedColumnProxyList.OrderBy(o => o.Name).ToList <DesignedColumnProxy>();
                Report             reportObj     = new BReport().GetByID(reportId);
                DesignedReportType reportTypeObj = GetAllDesignedReportsTypes().SingleOrDefault(d => d.CustomCode == DesignedReportTypeEnum.Daily);
                if (reportObj.DesignedType == reportTypeObj)
                {
                    IList <PersonParamField> personParamFieldList = new BPersonParamFields().GetAll().Where(p => p.Active && p.SubSystemId == SubSystemIdentifier.TimeAtendance).ToList();
                    foreach (PersonParamField item in personParamFieldList)
                    {
                        DesignedColumnProxy columnProxy = new DesignedColumnProxy(); DesignedReportPersonInfoColumn designedReportPersonInfoColumnObj = new DesignedReportPersonInfoColumn();
                        columnProxy.EnName = item.EnTitle;
                        columnProxy.FnName = item.FnTitle;
                        switch (BLanguage.CurrentLocalLanguage)
                        {
                        case LanguagesName.Parsi:
                            columnProxy.Name = item.FnTitle;
                            break;

                        case LanguagesName.English:
                            columnProxy.Name = item.EnTitle;
                            break;

                        default:
                            columnProxy.Name = item.FnTitle;
                            break;
                        }
                        columnProxy.ColumnType = DesignedReportColumnType.PersonParam;
                        columnProxy.ID         = item.ID;
                        columnProxy.KeyColumn  = item.Key;
                        designedColumnProxyList.Add(columnProxy);
                    }
                }

                return(designedColumnProxyList);
            }
            catch (Exception ex)
            {
                LogException(ex, "BDesignedReportsColumn", "GetAllDesignedReportsPersonInfoColumns");
                throw ex;
            }
        }
        public IList <DesignedReportPersonInfoColumn> GetAllDesignedReportsPersonInfoColumns()
        {
            try
            {
                IList <DesignedReportPersonInfoColumn> designedReportPersonInfoColumnList = new List <DesignedReportPersonInfoColumn>();
                designedReportPersonInfoColumnList = repDesignedReportPersonInfoColumn.GetAll().ToList <DesignedReportPersonInfoColumn>();
                IList <PersonReserveField> personReserveFieldList = new List <PersonReserveField>();
                if (designedReportPersonInfoColumnList.Count(d => d != null && d.IsReserveField) > 0)
                {
                    personReserveFieldList = new BPersonReservedField().GetAll();
                }
                foreach (DesignedReportPersonInfoColumn item in designedReportPersonInfoColumnList)
                {
                    if (item.IsReserveField)
                    {
                        string             itemKey = item.Key.ToString().Replace("prsTA_", "");
                        PersonReserveField personReserveFieldObj = personReserveFieldList.FirstOrDefault(r => r.OrginalName.ToLower().Trim() == itemKey.ToLower().Trim());
                        if (personReserveFieldObj != null)
                        {
                            item.Name = personReserveFieldObj.Lable;
                        }
                        else
                        {
                            switch (BLanguage.CurrentLocalLanguage)
                            {
                            case LanguagesName.Parsi:
                                item.Name = item.FnName;
                                break;

                            case LanguagesName.English:
                                item.Name = item.EnName;
                                break;

                            default:
                                item.Name = item.FnName;
                                break;
                            }
                        }
                    }
                    else
                    {
                        switch (BLanguage.CurrentLocalLanguage)
                        {
                        case LanguagesName.Parsi:
                            item.Name = item.FnName;
                            break;

                        case LanguagesName.English:
                            item.Name = item.EnName;
                            break;

                        default:
                            item.Name = item.FnName;
                            break;
                        }
                    }
                }
                IList <PersonParamField> personParamFieldList = new BPersonParamFields().GetAll().Where(p => p.Active && p.SubSystemId == SubSystemIdentifier.TimeAtendance).ToList();
                foreach (PersonParamField item in personParamFieldList)
                {
                    DesignedReportPersonInfoColumn designedReportPersonInfoColumnObj = new DesignedReportPersonInfoColumn();
                    designedReportPersonInfoColumnObj.EnName = item.EnTitle;
                    designedReportPersonInfoColumnObj.FnName = item.FnTitle;

                    //switch (BLanguage.CurrentLocalLanguage)
                    //{
                    //    case LanguagesName.Unknown:
                    //        conceptProxy.Name = item.FnTitle;
                    //        break;
                    //    case LanguagesName.Parsi:
                    //        conceptProxy.Name = item.FnTitle;
                    //        break;
                    //    case LanguagesName.English:
                    //        conceptProxy.Name = item.EnTitle;
                    //        break;
                    //    default:
                    //        conceptProxy.Name = item.FnTitle;
                    //        break;
                    //}
                    //conceptProxyList.Add(conceptProxy);
                }
                designedReportPersonInfoColumnList = designedReportPersonInfoColumnList.OrderBy(o => o.Name).ToList <DesignedReportPersonInfoColumn>();
                return(designedReportPersonInfoColumnList);
            }
            catch (Exception ex)
            {
                LogException(ex, "BDesignedReportsColumn", "GetAllDesignedReportsPersonInfoColumns");
                throw ex;
            }
        }