Exemple #1
0
        public DailyReportProxy GetPersonDailyReport(decimal personId, string miladiDate)
        {
            try
            {
                DateTime dayDate = Utility.ToMildiDateTime(miladiDate);
                BPersonMonthlyWorkedTime monthlyReport = new BPersonMonthlyWorkedTime(personId);
                PersonalMonthlyReportRow row           = monthlyReport.GetPersonDailyReport(dayDate);

                DailyReportProxy proxy = new DailyReportProxy();
                proxy.AllowableOverTime        = row.AllowableOverTime;
                proxy.DailyAbsence             = row.DailyAbsence;
                proxy.DailyMission             = row.DailyMission;
                proxy.HourlyMeritoriouslyLeave = row.HourlyMeritoriouslyLeave;
                proxy.HourlyMission            = row.HourlyMission;
                proxy.HourlyPureOperation      = row.HourlyPureOperation;
                proxy.HourlySickLeave          = row.HourlySickLeave;
                proxy.HourlyUnallowableAbsence = row.HourlyUnallowableAbsence;
                proxy.HourlyWithoutPayLeave    = row.HourlyWithoutPayLeave;
                proxy.ShiftPairs = row.ShiftPairs;

                return(proxy);
            }
            catch (Exception ex)
            {
                LogException(ex, "BTraffic", "GetPersonDailyReport");
                throw ex;
            }
        }
    /// <summary>
    /// بادریافت شماره پرسنلی ، کارکرد را برمیگرداند
    /// </summary>
    /// <param name="personCode">شماره پرسنلی</param>
    /// <param name="fromDate">تاریخ شروع</param>
    /// <param name="toDate">تاریخ پایان</param>
    /// <returns></returns>
    private TAProxy Fill(string personCode, DateTime fromDate, DateTime toDate)
    {
        BPerson personBusiness = new BPerson();
        var     person         = personBusiness.GetByBarcode(personCode);

        if (person == null)
        {
            return(new TAProxy());
        }

        IList <PersonalMonthlyReportRow> PersonnelMonthlyOperationList    = null;
        PersonalMonthlyReportRow         PersonnelSummaryMonthlyOperation = null;
        BPersonMonthlyWorkedTime         MonthlyOperationBusiness         = new BPersonMonthlyWorkedTime(person.ID);

        var personDateRangeReportProxy = MonthlyOperationBusiness.GetPersonDateRangeReport(fromDate, toDate).FirstOrDefault();

        TAProxy proxy = new TAProxy();

        proxy.PersonCode   = personCode;
        proxy.HozourTime   = personDateRangeReportProxy.PresenceDuration;         //35 * 60;//"35:00"
        proxy.KasreKarTime = personDateRangeReportProxy.HourlyUnallowableAbsence; //2 * 60 + 50;//"02:50"
        proxy.MamuriatTime = personDateRangeReportProxy.HourlyMission;            //12 * 60;//"12:00"
        proxy.KarkerdSum   = personDateRangeReportProxy.ImpureOperation;          //47 * 60;//12:00 + 35:00
        return(proxy);
    }
        public void GetReport_PriodicValuesTest_Dependent()
        {
            BPersonMonthlyWorkedTime         bpWorkTime = new BPersonMonthlyWorkedTime(32687);
            IList <PersonalMonthlyReportRow> DailyRows  = null;
            PersonalMonthlyReportRow         MonthlyRow = null;

            bpWorkTime.GetPersonMonthlyReport(1390, 7, "1390/06/16", "1390/07/15", out DailyRows, out MonthlyRow);
            Assert.IsTrue(MonthlyRow.PeriodicPresenceDuration != "00:00" && MonthlyRow.PeriodicPresenceDuration != "");
        }
        public void GetReport_PersonalDailyReportTest()
        {
            try
            {
                PersianDateTime          dt = new PersianDateTime(DateTime.Now);
                BPersonMonthlyWorkedTime pb = new BPersonMonthlyWorkedTime(32688);
                ClearSession();
                PersonalMonthlyReportRow row = pb.GetPersonDailyReport(Utility.ToMildiDate("1390/06/03"));

                string value = row.PeriodicDailyPureOperation;
            }
            catch (Exception ex) { Assert.Fail(ex.Message); }
        }
 public void GetReport_PersonalMonthlyReportPropertyTest()
 {
     try
     {
         BPersonMonthlyWorkedTime         bpWorkTime = new BPersonMonthlyWorkedTime(32688);
         IList <PersonalMonthlyReportRow> DailyRows  = null;
         PersonalMonthlyReportRow         MonthlyRow = null;
         bpWorkTime.GetPersonMonthlyReport(1390, 6, "1390/05/10", "1390/06/15", out DailyRows, out MonthlyRow);
         string value = DailyRows[0].DailySickLeave;
         value = DailyRows[1].DailySickLeave;
     }
     catch (Exception Exception)
     {
         Assert.Fail(Exception.Message);
     }
 }
 public void GetReport_EmptyDateRangeValidate()
 {
     try
     {
         BPersonMonthlyWorkedTime         bpWorkTime = new BPersonMonthlyWorkedTime(ADOPerson1.ID);
         IList <PersonalMonthlyReportRow> DailyRows  = null;
         PersonalMonthlyReportRow         MonthlyRow = null;
         bpWorkTime.GetPersonMonthlyReport(2000, 2, "", "", out DailyRows, out MonthlyRow);
         PersonalMonthlyReportRow pmrr = DailyRows[0];
         Assert.Fail("دوره محاسبات ندارد");
     }
     catch (InvalidDatabaseStateException ex)
     {
         Assert.Pass(ex.Message);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
 private void Fill_GridSummaryMonthlyOperation_MasterMonthlyOperation()
 {
     if (Session["MonthlyOperationSource_MasterMonthlyOperation"] != null)
     {
         PersonalMonthlyReportRow        personalMonthlyReportRow    = (PersonalMonthlyReportRow)((Dictionary <string, object>)Session["MonthlyOperationSource_MasterMonthlyOperation"])["Summary"];
         SummaryMonthlyOperation         summaryMonthlyOperation     = new SummaryMonthlyOperation();
         IList <SummaryMonthlyOperation> SummaryMonthLyOperationList = new List <SummaryMonthlyOperation>();
         GridColumnCollection            Gcc = GridSummaryMonthlyOperation_MasterMonthlyOperation.Levels[0].Columns;
         for (int i = 1; i < Gcc.Count; i++)
         {
             PropertyInfo PInfo = typeof(SummaryMonthlyOperation).GetProperty(Gcc[i].DataField);
             if (PInfo != null)
             {
                 PInfo.SetValue(summaryMonthlyOperation, (string)typeof(PersonalMonthlyReportRow).GetProperty("Periodic" + Gcc[i].DataField).GetValue(personalMonthlyReportRow, null), null);
             }
         }
         SummaryMonthLyOperationList.Add(summaryMonthlyOperation);
         this.GridSummaryMonthlyOperation_MasterMonthlyOperation.DataSource = SummaryMonthLyOperationList;
         this.GridSummaryMonthlyOperation_MasterMonthlyOperation.DataBind();
     }
 }
Exemple #8
0
        protected void Button42_Click(object sender, EventArgs e)
        {
            #region SetGridColumnsSize_MasterMonthlyOperation
            BGridMonthlyOperationClientSettings       MonthlyOperationGridClientSettingsBusiness = new BGridMonthlyOperationClientSettings();
            MonthlyOperationGridClientGeneralSettings monthlyOperationGridClientGeneralSettings  = MonthlyOperationGridClientSettingsBusiness.GetMonthlyOperationGridGeneralClientSettings();
            #endregion

            #region SetVisibleColumns_MasterMonthlyOperation
            MonthlyOperationGridClientSettings monthlyOperationGridClientSettings = MonthlyOperationGridClientSettingsBusiness.GetMonthlyOperationGridClientSettings();
            #endregion

            #region SetReserveFieldsHeaderColumnsCaption_MasterMonthlyOperation
            BPersonMonthlyWorkedTime MonthlyOperationBusiness = new BPersonMonthlyWorkedTime(0);
            IDictionary <ConceptReservedFields, string> dic   = MonthlyOperationBusiness.GetReservedFieldsNames();

            /*foreach (string conceptReservedFieldName in Enum.GetNames(typeof(ConceptReservedFields)))
             * {
             *  string HeadingText = MonthlyOperationBusiness.GetReservedFieldsName((ConceptReservedFields)Enum.Parse(typeof(ConceptReservedFields), conceptReservedFieldName));
             * }*/
            #endregion

            #region Fill_GridMasterMonthlyOperation_MasterMonthlyOperation
            IList <PersonalMonthlyReportRow> PersonnelMonthlyOperationList    = null;
            PersonalMonthlyReportRow         PersonnelSummaryMonthlyOperation = null;
            try
            {
                decimal PersonnelID = BUser.CurrentUser.Person.ID;

                BPersonMonthlyWorkedTime MonthlyOperationBusiness1 = new BPersonMonthlyWorkedTime(PersonnelID);
                MonthlyOperationBusiness.GetPersonMonthlyReport(1391, 12, "1391/12/01", "1391/12/29", out PersonnelMonthlyOperationList, out PersonnelSummaryMonthlyOperation);

                Dictionary <string, object> MonthlyOperationSourceDic = new Dictionary <string, object>();
                MonthlyOperationSourceDic.Add("Details", PersonnelMonthlyOperationList);
                MonthlyOperationSourceDic.Add("Summary", PersonnelSummaryMonthlyOperation);
            }
            catch { }

            #endregion
        }
        public void GetUnderManagmentBySearch_BarcodeTest22222()
        {
            try
            {
                BPersonMonthlyWorkedTime         bpWorkTime = new BPersonMonthlyWorkedTime(32687);
                IList <PersonalMonthlyReportRow> DailyRows  = null;
                PersonalMonthlyReportRow         MonthlyRow = null;
                bpWorkTime.GetPersonMonthlyReport(1390, 7, "1390/08/01", "1390/08/30", out DailyRows, out MonthlyRow);

                string a = DailyRows[0].UnallowableOverTime;
                IList <PersonalMonthlyReportRow> xxx  = DailyRows.Where(x => x.HourlyPureOperation != "00:00").ToList();
                PersonalMonthlyReportRow         pmrr = DailyRows[2];
                string x0   = pmrr.ImpureOperation;
                string x1   = pmrr.PeriodicDailyAbsence;
                string x2   = pmrr.DailyAbsence;
                User   user = BUser.CurrentUser;


                IList <MonthlyDetailReportProxy> list2 = bpWorkTime.GetPersonMonthlyRowDetail(new DateTime(2011, 9, 7));
            }
            catch (Exception ex)
            {
            }
        }
        private void Fill_GridMasterMonthlyOperation_MasterMonthlyOperation(LoadState LS, decimal PersonnelID, int Year, int Month, string FromDate, string ToDate)
        {
            string[] retMessage = new string[4];
            IList <PersonalMonthlyReportRow> PersonnelMonthlyOperationList    = null;
            PersonalMonthlyReportRow         PersonnelSummaryMonthlyOperation = null;

            try
            {
                if (Session["Year_MasterMonthlyOperation"] != null)
                {
                    if ((int)Session["Year_MasterMonthlyOperation"] != Year)
                    {
                        Session["MonthlyOperationSource_MasterMonthlyOperation"] = null;
                    }
                }
                if (Session["Month_MasterMonthlyOperation"] != null)
                {
                    if ((int)Session["Month_MasterMonthlyOperation"] != Month)
                    {
                        Session["MonthlyOperationSource_MasterMonthlyOperation"] = null;
                    }
                }
                if (Session["MonthlyOperationSource_MasterMonthlyOperation"] == null)
                {
                    switch (LS)
                    {
                    case LoadState.Manager:
                        break;

                    case LoadState.Personnel:
                        PersonnelID = BUser.CurrentUser.Person.ID;
                        break;
                    }

                    BPersonMonthlyWorkedTime MonthlyOperationBusiness = new BPersonMonthlyWorkedTime(PersonnelID);
                    MonthlyOperationBusiness.GetPersonMonthlyReport(Year, Month, FromDate, ToDate, out PersonnelMonthlyOperationList, out PersonnelSummaryMonthlyOperation);
                    //DateRangeHelper drh = new DateRangeHelper();
                    //drh.GetPersonMonthlyReport(Year, Month, FromDate, ToDate, out PersonnelMonthlyOperationList, out PersonnelSummaryMonthlyOperation);

                    Session.Add("Year_MasterMonthlyOperation", Year);
                    Session.Add("Month_MasterMonthlyOperation", Month);
                    Dictionary <string, object> MonthlyOperationSourceDic = new Dictionary <string, object>();
                    MonthlyOperationSourceDic.Add("Details", PersonnelMonthlyOperationList);
                    MonthlyOperationSourceDic.Add("Summary", PersonnelSummaryMonthlyOperation);
                    Session.Add("MonthlyOperationSource_MasterMonthlyOperation", MonthlyOperationSourceDic);
                }
                this.operationYearMonthProvider.SetOperationYearMonth(Year, Month);
                GridMasterMonthlyOperation_MasterMonthlyOperation.DataSource = (IList <PersonalMonthlyReportRow>)((Dictionary <string, object>)Session["MonthlyOperationSource_MasterMonthlyOperation"])["Details"];
                GridMasterMonthlyOperation_MasterMonthlyOperation.DataBind();
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_MonthlyOperation.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_MonthlyOperation.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_MonthlyOperation.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }
        /// <summary>
        /// برای تست استفاده میشود
        /// </summary>
        /// <param name="username"></param>
        //public BPersonMonthlyWorkedTime(string username)
        //{
        //    this.Username = username;
        //    if (AppSettings.BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
        //    {
        //        this.sysLanguageResource = LanguagesName.Parsi;
        //    }
        //    else if (AppSettings.BLanguage.CurrentSystemLanguage == LanguagesName.English)
        //    {
        //        this.sysLanguageResource = LanguagesName.English;
        //    }
        //}

        #endregion

        /// <summary>
        /// سطرهای گزارش کارکرد ماهانه را برای یک دوره یک ماهه برمیگرداند
        /// </summary>
        /// <param name="year">سال</param>
        /// <param name="month">ماه</param>
        /// <param name="fromDate">از تاریخ</param>
        /// <param name="toDate">تا تاریخ</param>
        /// <param name="DailyRows">لیست سطرهای روز گزارش کارکرد</param>
        /// <param name="MonthlyRow">لیست سطرهای ماه گزارش کارکرد</param>
        public void GetPersonMonthlyReport(int year, int month, string fromDate, string toDate, out IList <PersonalMonthlyReportRow> DailyRows, out PersonalMonthlyReportRow MonthlyRow)
        {
            try
            {
                if (Utility.IsEmpty(fromDate) || Utility.IsEmpty(toDate))
                {
                    throw new InvalidDatabaseStateException(UIFatalExceptionIdentifiers.PersonDateRangeIsNotDefiend, String.Format("برای شخص {0} رینج محاسبات تعریف نشده است", workingPersonId), ExceptionSrc);
                }
                if (IsValidPeson())
                {
                    DateTime date = new DateTime(year, month, Utility.GetEndOfMiladiMonth(year, month));
                    if (sysLanguageResource == LanguagesName.Parsi)
                    {
                        date = Utility.ToMildiDate(String.Format("{0}/{1}/{2}", year, month, Utility.GetEndOfPersianMonth(year, month)));
                    }
                    DateTime from, to;
                    if (sysLanguageResource == LanguagesName.Parsi)
                    {
                        from = Utility.ToMildiDate(fromDate);
                        to   = Utility.ToMildiDate(toDate);
                    }
                    else
                    {
                        from = Utility.ToMildiDateTime(fromDate);
                        to   = Utility.ToMildiDateTime(toDate);
                    }
                    //BTemp bTemp = new BTemp();
                    //List<decimal> list = new List<decimal>();
                    //list.Add(this.workingPersonId);
                    //string operationGUID = bTemp.InsertTempList(list);
                    //gtsEngineWS.GTS_ExecutePersonsByToDateGUID(BUser.CurrentUser.UserName, operationGUID, to);
                    //bTemp.DeleteTempList(operationGUID);
                    gtsEngineWS.GTS_ExecuteByPersonID(BUser.CurrentUser.UserName, this.workingPersonId);
                    PersonalMonthlyReport Result = new PersonalMonthlyReport(this.workingPersonId, date, month, from, to);
                    Result.LanguageName = sysLanguageResource;

                    DailyRows  = Result.PersonalMonthlyReportRows;
                    MonthlyRow = DailyRows.FirstOrDefault();

                    foreach (PersonalMonthlyReportRow row in DailyRows)
                    {
                        //Day State Title
                        //fa:{0};en:{1}
                        if (!Utility.IsEmpty(row.DayStateTitle) && row.DayStateTitle.Contains(';'))
                        {
                            if (BLanguage.CurrentLocalLanguage == LanguagesName.Parsi)
                            {
                                row.DayStateTitle = Utility.Spilit(row.DayStateTitle, ';')[0].Replace("fa:", "");
                            }
                            else
                            {
                                row.DayStateTitle = Utility.Spilit(row.DayStateTitle, ';')[1].Replace("en:", "");
                            }
                        }
                        else
                        {
                            row.DayStateTitle = "";
                        }
                    }
                }
                else
                {
                    throw new IllegalServiceAccess(String.Format("این سرویس بعللت اعتبارسنجی قابل دسترسی نمیباشد. شناسه کاربری {0} میباشد", this.Username), ExceptionSrc);
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BPersonMonthlyWorkedTime", "GetPersonMonthlyReport");

                throw ex;
            }
        }
        private IList <TaskFeatures> SetDataPointFeatures_MonthlyOperationGanttChartSchema(IList <TaskFeatures> TaskFeaturesList, string ConceptType, string FromTime, string ToTime, PersonalMonthlyReportRow personalMonthlyReportRow, PersonalMonthlyReportRowDetail personalMonthlyReportRowDetail, Series serie, DataPointCollection dataPointCollection)
        {
            TaskFeatures[] TaskFeaturesCol = new TaskFeatures[1024];

            int serieIndex     = this.GanttChartMonthlyOperation_MonthlyOperationGanttChartSchema.Series.GetIndex(serie.Name);
            int dataPointIndex = dataPointCollection.Count - 1;

            TaskFeatures taskFeatures = new TaskFeatures();

            taskFeatures      = new TaskFeatures();
            taskFeatures.Key  = serie.Name + "%" + dataPointIndex.ToString();
            taskFeatures.Name = GetLocalResourceObject(serie.Name) != null?GetLocalResourceObject(serie.Name).ToString() : serie.Name;

            taskFeatures.Type           = ConceptType;
            taskFeatures.FromTime       = FromTime;
            taskFeatures.ToTime         = ToTime;
            taskFeatures.SerieIndex     = serieIndex.ToString();
            taskFeatures.DataPointIndex = dataPointIndex.ToString();
            taskFeatures.DateKey        = personalMonthlyReportRow.ID.ToString();
            taskFeatures.DayName        = personalMonthlyReportRow.DayName;
            taskFeatures.Date           = personalMonthlyReportRow.Date.Year + "/" + personalMonthlyReportRow.Date.Month + "/" + personalMonthlyReportRow.Date.Day;
            taskFeatures.UIDate         = personalMonthlyReportRow.TheDate;
            TaskFeaturesList.Add(taskFeatures);

            dataPointCollection[dataPointIndex].ToolTip  = taskFeatures.DayName + " " + taskFeatures.UIDate;
            dataPointCollection[dataPointIndex].ToolTip += " \n" + taskFeatures.Name;
            dataPointCollection[dataPointIndex].ToolTip += " \n" + GetLocalResourceObject("From").ToString() + " " + taskFeatures.FromTime;
            dataPointCollection[dataPointIndex].ToolTip += " \n" + GetLocalResourceObject("To").ToString() + " " + taskFeatures.ToTime;
            dataPointCollection[dataPointIndex].ToolTip += " \n" + GetLocalResourceObject("ImpureValue").ToString() + " " + personalMonthlyReportRowDetail.ImpureValue;

            return(TaskFeaturesList);
        }