private void SetRegisteredRequestsPageCount_RegisteredRequests(string StrRequestFliterProxyList)
    {
        UserRequestFilterProxy CustomFilterProxy = GetRegisteredRequestsCustomFilterProxy_RegisteredRequests(StrRequestFliterProxyList);
        int RegisteredRequestsCount = this.RegisteredRequestsBusiness.GetFilterUserRequestsCount(CustomFilterProxy);

        this.hfRegisteredRequestsCount_RegisteredRequests.Value     = RegisteredRequestsCount.ToString();
        this.hfRegisteredRequestsPageCount_RegisteredRequests.Value = Utility.GetPageCount(RegisteredRequestsCount, this.GridRegisteredRequests_RegisteredRequests.PageSize).ToString();
    }
예제 #2
0
        public void Operator_GetFilterRequestCount1()
        {
            busRegisteredRequest = new BKartabl(ADOPerson1.ID, ADOUser1.ID, ADOUser1.UserName);
            UserRequestFilterProxy proxy = new UserRequestFilterProxy();

            proxy.ToDate = Utility.ToPersianDate(new DateTime(2010, 5, 1));
            int count = busRegisteredRequest.GetFilterUserRequestsCount(proxy);

            Assert.AreEqual(1, count);
        }
예제 #3
0
        public void Operator_GetFilterRequest1()
        {
            busRegisteredRequest = new BKartabl(ADOPerson1.ID, ADOUser1.ID, ADOUser1.UserName);
            UserRequestFilterProxy proxy = new UserRequestFilterProxy();

            proxy.ToDate = Utility.ToPersianDate(new DateTime(2010, 5, 1));
            IList <KartablProxy> list = busRegisteredRequest.GetFilterUserRequests(proxy, 0, 10);

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(ADORequestHourlyLeave1.ID, list.First().RequestID);
        }
예제 #4
0
 public void GetRequestCount_Filter_Test1()
 {
     try
     {
         UserRequestFilterProxy proxy = new UserRequestFilterProxy();
         proxy.RequestType = RequestType.Hourly;
         int count = busRegisteredRequest.GetFilterUserRequestsCount(proxy);
         Assert.AreEqual(3, count);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
예제 #5
0
 public void GetRequestCount_Filter_Test3()
 {
     try
     {
         busRegisteredRequest = new BKartabl(ADOPerson3.ID, ADOUser3.ID, ADOUser3.UserName);
         UserRequestFilterProxy proxy = new UserRequestFilterProxy();
         proxy.ToDate = Utility.ToPersianDate(new DateTime(2010, 5, 1));
         int count = busRegisteredRequest.GetFilterUserRequestsCount(proxy);
         Assert.AreEqual(1, count);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
예제 #6
0
 public void GetRequestCount_Filter_Test2()
 {
     try
     {
         busRegisteredRequest = new BKartabl(ADOPerson5.ID, ADOUser5.ID, ADOUser5.UserName);
         UserRequestFilterProxy proxy = new UserRequestFilterProxy();
         proxy.RequestType = RequestType.Daily;
         int count = busRegisteredRequest.GetFilterUserRequestsCount(proxy);
         Assert.AreEqual(1, count);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
예제 #7
0
 public void GetRequest_Filter_Test3()
 {
     try
     {
         busRegisteredRequest = new BKartabl(ADOPerson3.ID, ADOUser3.ID, ADOUser3.UserName);
         UserRequestFilterProxy proxy = new UserRequestFilterProxy();
         proxy.ToDate = Utility.ToPersianDate(new DateTime(2010, 5, 1));
         IList <KartablProxy> list = busRegisteredRequest.GetFilterUserRequests(proxy, 0, 10);
         Assert.AreEqual(1, list.Count);
         Assert.IsTrue(list.Where(x => x.RequestID == ADORequestHourlyLeave1.ID).Count() == 1);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
예제 #8
0
 public void GetRequest_Filter_Test2()
 {
     try
     {
         busRegisteredRequest = new BKartabl(ADOPerson5.ID, ADOUser5.ID, ADOUser5.UserName);
         UserRequestFilterProxy proxy = new UserRequestFilterProxy();
         proxy.RequestType = RequestType.Daily;
         IList <KartablProxy> list = busRegisteredRequest.GetFilterUserRequests(proxy, 0, 10);
         Assert.AreEqual(1, list.Count);
         Assert.IsTrue(list.Where(x => x.ID == ADORequestDailyLeave1.ID).Count() == 1);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
예제 #9
0
        public void Test222222222222()
        {
            ClearSession();
            base.UpdateCurrentUserPersonId(32688);

            BKartabl b = new BKartabl();

            busRegisteredRequest = new BKartabl();
            UserRequestFilterProxy proxy = new UserRequestFilterProxy();

            proxy.RequestType = RequestType.Daily;
            IList <KartablProxy> list = busRegisteredRequest.GetAllUserRequests(RequestState.UnKnown, 1390, 12, 0, 14);

            list = busRegisteredRequest.GetFilterUserRequests(proxy, 0, 10);
            busRegisteredRequest.GetAllUserRequests(RequestState.UnKnown, 1390, 10, 0, 12);
            busRegisteredRequest.GetAllUserRequests(RequestState.UnKnown, 1390, 10, 1, 12);
        }
예제 #10
0
 public void GetRequest_Filter_Test1()
 {
     try
     {
         UserRequestFilterProxy proxy = new UserRequestFilterProxy();
         proxy.RequestType = RequestType.Hourly;
         IList <KartablProxy> list = busRegisteredRequest.GetFilterUserRequests(proxy, 0, 10);
         Assert.AreEqual(3, list.Count);
         Assert.IsTrue(list.Where(x => x.ID == ADORequestHourlyLeave1.ID).Count() == 1);
         Assert.IsTrue(list.Where(x => x.ID == ADORequestHourlyLeave2.ID).Count() == 1);
         Assert.IsTrue(list.Where(x => x.ID == ADORequestHourlyDuty1.ID).Count() == 1);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
예제 #11
0
    private void Fill_GridRegisteredRequests_RegisteredRequests(CurrentUserState CUS, string LoadState, int year, int month, string filterString, int pageSize, int pageIndex)
    {
        string[]             retMessage             = new string[4];
        IList <KartablProxy> RegisteredRequestsList = null;

        try
        {
            switch (LoadState)
            {
            case "CustomFilter":
                UserRequestFilterProxy CustomFilterProxy = this.GetRegisteredRequestsCustomFilterProxy_RegisteredRequests(filterString);
                RegisteredRequestsList = this.RegisteredRequestsBusiness.GetFilterUserRequests(CustomFilterProxy, pageIndex, pageSize);
                break;

            default:
                RegisteredRequestsList = this.RegisteredRequestsBusiness.GetAllUserRequests((RequestState)Enum.Parse(typeof(RequestState), LoadState), year, month, pageIndex, pageSize);
                break;
            }
            this.operationYearMonthProvider.SetOperationYearMonth(year, month);
            this.GridRegisteredRequests_RegisteredRequests.DataSource = RegisteredRequestsList;
            this.GridRegisteredRequests_RegisteredRequests.DataBind();
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (OutOfExpectedRangeException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
    private UserRequestFilterProxy GetRegisteredRequestsCustomFilterProxy_RegisteredRequests(string strCustomFilter)
    {
        UserRequestFilterProxy customFilterProxy = new UserRequestFilterProxy();

        if (strCustomFilter != string.Empty)
        {
            JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
            Dictionary <string, object> ParamsDic    = (Dictionary <string, object>)jsSerializer.DeserializeObject(strCustomFilter);
            CurrentUserState            CUS          = (CurrentUserState)Enum.Parse(typeof(CurrentUserState), ParamsDic["currentUserState"].ToString());
            int    personnelID     = int.Parse(ParamsDic["personnelID"].ToString(), CultureInfo.InvariantCulture);
            int    requestTypeID   = int.Parse(ParamsDic["requestTypeID"].ToString(), CultureInfo.InvariantCulture);
            int    requestExporter = int.Parse(ParamsDic["requestExporter"].ToString(), CultureInfo.InvariantCulture);
            string fromDate        = ParamsDic["fromDate"].ToString();
            string toDate          = ParamsDic["toDate"].ToString();
            switch (CUS)
            {
            case CurrentUserState.NormalUser:
                break;

            case CurrentUserState.Operator:
                customFilterProxy.UnderManagmentPersonId = personnelID;
                break;
            }
            if (requestTypeID != -1)
            {
                customFilterProxy.RequestType = (RequestType)Enum.ToObject(typeof(RequestType), requestTypeID);
            }
            if (requestExporter != -1)
            {
                customFilterProxy.RequestSubmiter = (RequestSubmiter)Enum.ToObject(typeof(RequestSubmiter), requestExporter);
            }
            if (fromDate != string.Empty)
            {
                customFilterProxy.FromDate = fromDate;
            }
            if (toDate != string.Empty)
            {
                customFilterProxy.ToDate = toDate;
            }
        }
        return(customFilterProxy);
    }
    private void Fill_GridRegisteredRequests_RegisteredRequests(CurrentUserState CUS, string LoadState, int year, int month, string filterString, int pageSize, int pageIndex)
    {
        string[]             retMessage             = new string[4];
        IList <KartablProxy> RegisteredRequestsList = null;

        try
        {
            Applicant           applicant   = Applicant.None;
            KartablSummaryItems itemSummary = KartablSummaryItems.UnKnown;
            if (HttpContext.Current.Request.QueryString.AllKeys.Contains("Applicant") && this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["Applicant"]) != "")
            {
                applicant = (Applicant)Enum.Parse(typeof(Applicant), this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["Applicant"]));
                if (applicant == Applicant.PrivateNews)
                {
                    itemSummary = (KartablSummaryItems)Enum.Parse(typeof(KartablSummaryItems), this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["KeyApplicant"]));
                    switch (itemSummary)
                    {
                    case KartablSummaryItems.ConfirmedRequestCount:
                        LoadState = RequestState.Confirmed.ToString();
                        break;

                    case KartablSummaryItems.NotConfirmedRequestCount:
                        LoadState = RequestState.Unconfirmed.ToString();
                        break;

                    case KartablSummaryItems.InFlowRequestCount:
                        LoadState = RequestState.UnderReview.ToString();
                        break;

                    default:
                        break;
                    }
                }
            }
            switch (LoadState)
            {
            case "CustomFilter":
                UserRequestFilterProxy CustomFilterProxy = this.GetRegisteredRequestsCustomFilterProxy_RegisteredRequests(filterString);
                RegisteredRequestsList = this.RegisteredRequestsBusiness.GetFilterUserRequests(CustomFilterProxy, pageIndex, pageSize);
                break;

            default:
                RegisteredRequestsList = this.RegisteredRequestsBusiness.GetAllUserRequests((RequestState)Enum.Parse(typeof(RequestState), LoadState), year, month, pageIndex, pageSize, itemSummary);
                break;
            }

            this.operationYearMonthProvider.SetOperationYearMonth(year, month);
            this.GridRegisteredRequests_RegisteredRequests.DataSource = RegisteredRequestsList;
            this.GridRegisteredRequests_RegisteredRequests.DataBind();
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (OutOfExpectedRangeException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }