public List <InpsRating> GetBy(Period period, InpsType inpsType) { try { Func <INPS_RATING, bool> selector = nr => nr.Period_ID == period.Id && nr.Inps_Type_Id == inpsType.Id; return(base.GetModelsBy(selector)); } catch (Exception) { throw; } }
public void ReadInpsExcelFile(string fileName, byte[] bytes, InpsType inpsType) { try { ReadInpsExcelFileCompleted(); service.UploadInpsSourceFile(fileName, bytes, Utility.Period, inpsType); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
public List <Inps> GetBy(Period period, InpsType inpsType) { try { Func <INPS, bool> selector = nps => nps.Period_ID == period.Id && nps.Inps_Type_Id == inpsType.Id; return(base.GetModelsBy(selector)); } catch (Exception) { throw; } }
//public void GetAllInpsBy(Period period) //{ // try // { // service = new ServiceClient(); // service.GetAllInpsByPeriodCompleted += new EventHandler<GetAllInpsByPeriodCompletedEventArgs>(service_GetAllInpsByPeriodCompleted); // service.GetAllInpsByPeriodAsync(period); // service.CloseAsync(); // } // catch (Exception) // { // throw; // } //} public void GetAllInpsBy(Period period, InpsType inpsType) { try { service = new ServiceClient(); service.GetInpsByPeriodAndTypeCompleted += new EventHandler <GetInpsByPeriodAndTypeCompletedEventArgs>(service_GetInpsByPeriodAndTypeCompleted); service.GetInpsByPeriodAndTypeAsync(period, inpsType); service.CloseAsync(); } catch (Exception) { throw; } }
public List <Inps> Read(string filePath, Period period, InpsType inpsType) { try { DataTable excelData = ReadDataTable(filePath); if (excelData == null || excelData.Rows.Count == 0) { //FileManager fm = new FileManager(; throw new Exception("No data found on excel!"); } List <Inps> npss = new List <Inps>(); for (int i = 0; i < excelData.Rows.Count; i++) { Inps nps = new Inps(); nps.Staff = new Model.Staff(); nps.ResponsibleDepartment = new Department(); //nps.Perspective = new MetricsPerspective() { Id = 1 }; nps.Type = inpsType; nps.Staff.Id = excelData.Rows[i][0] == DBNull.Value ? null : Convert.ToString(excelData.Rows[i][0]); nps.Kpi = excelData.Rows[i][1] == DBNull.Value ? null : Convert.ToString(excelData.Rows[i][1]); nps.Measure = excelData.Rows[i][2] == DBNull.Value ? null : Convert.ToString(excelData.Rows[i][2]); nps.DataSource = excelData.Rows[i][3] == DBNull.Value ? null : Convert.ToString(excelData.Rows[i][3]); nps.ResponsibleDepartment.Id = excelData.Rows[i][4] == DBNull.Value ? null : Convert.ToString(excelData.Rows[i][4]); nps.Target = excelData.Rows[i][5] == DBNull.Value ? 0 : Convert.ToDecimal(excelData.Rows[i][5]); nps.Score = excelData.Rows[i][6] == DBNull.Value ? 0 : Convert.ToDecimal(excelData.Rows[i][6]); nps.Period = period; npss.Add(nps); } excelData.Clear(); return(npss); } catch (Exception) { throw; } }
protected void LoadAllInpsTypeCompletedHelper() { try { dispatcher.BeginInvoke (() => { if (Utility.FaultExist(inpsTypeService.Fault)) { return; } if (inpsTypeService.Models != null && inpsTypeService.Models.Count > 0) { List <InpsType> inpsTypes = inpsTypeService.Models.Where(d => d.Id != 0).ToList(); if (inpsTypes.Count > 0) { inpsTypes.Insert(0, new InpsType() { Name = "<< Select a Type >>" }); } InpsTypes = new PagedCollectionView(inpsTypes); InpsTypes.MoveCurrentToFirst(); InpsTypes.CurrentChanged += (s, e) => { InpsType = InpsTypes.CurrentItem as InpsType; if (InpsType != null && InpsType.Id > 0) { GetAllInpsByPeriodAndType(); } }; } }); } catch (Exception ex) { Utility.DisplayMessage(ex.Message); } }
private string AlreadyExist(Period period, InpsType inpsType) { try { string message = null; Func <INPS, bool> selector = inps => inps.Period_ID == period.Id && inps.Inps_Type_Id == inpsType.Id; List <Inps> inpss = base.GetModelsBy(selector); if (inpss != null && inpss.Count > 0) { message = inpsType.Name + " already exist for " + period.Name + "! "; } return(message); } catch (Exception) { throw; } }
public void UploadInpsSourceFile(string fileName, byte[] bytes, Period period, InpsType inpsType) { try { service = new ServiceClient(); service.ReadInpsExcelCompleted += new EventHandler <ReadInpsExcelCompletedEventArgs>(service_ReadInpsExcelCompleted); service.ReadInpsExcelAsync(fileName, bytes, period, inpsType); service.CloseAsync(); } catch (Exception) { throw; } }