///<summary>
        ///Purpose   : Generate AR request no. that related with customer code
        ///Parameters: - strARRelevantType = 0
        ///            - strARRelevantCode = C0000012025
        ///Expected  : Return to caller :
        ///            - strARRequestNo. = 000112A00001
        ///            - strAROffice = 0001
        ///</summary>
        public string Case2()
        {
            IARHandler target            = ServiceContainer.GetService <IARHandler>() as IARHandler;
            string     strARRelevantType = "0";
            string     strARRelevantCode = "C0000012025";

            string[] expected = new string[] { "000112A00001", "0001" };
            string[] actual   = null;
            string   error    = string.Empty;

            try
            {
                actual = target.GenerateARRequestNo(strARRelevantType, strARRelevantCode);
            }
            catch (ApplicationErrorException ex)
            {
                error = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                error = ex.StackTrace;
            }

            if (error == string.Empty)
            {
                //string strResult = CompareResult_String(expected, actual);
                //return string.Format(RESULT_FORMAT_LIST, 2, strResult);
                return(string.Format(RESULT_FORMAT, 2, SetResult_String(expected), SetResult_String(actual), CompareResult_String(expected, actual)));
            }
            else
            {
                return(string.Format(RESULT_FORMAT_ERROR, 2, "Fail", error));
            }
        }
        ///<summary>
        ///Purpose   : Generate AR request no. that related with customer code (How does the system performs if it over maximum of running no.)
        ///Parameters: - strARRelevantType = 0
        ///            - strARRelevantCode = C0000012025
        ///Expected  :  MSG3017: Cannot generate request no. because the number reach maximum, please contact administrator.
        ///</summary>
        public string Case1()
        {
            IARHandler target            = ServiceContainer.GetService <IARHandler>() as IARHandler;
            string     strARRelevantType = "0";
            string     strARRelevantCode = "C0000012025";

            string expected = "MSG3017";
            string actual;

            try
            {
                target.GenerateARRequestNo(strARRelevantType, strARRelevantCode);
                actual = string.Empty;
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 1, expected, actual, CompareResult_String(expected, actual)));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Search AR by criteria when click [Search] button on AR list by role section
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public ActionResult CTS360_SearchAR(SearchARCondition condition)
        {
            ObjectResultData res = new ObjectResultData();

            try {
                res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { condition });

                if (condition.SpecfyPeriod == null && (condition.SpecifyPeriodFrom.HasValue || condition.SpecifyPeriodTo.HasValue))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0116, null, new string[] { "cboSearchSpecifyPeriod" });
                }

                if (condition.SpecfyPeriod != null &&
                    condition.SpecifyPeriodFrom.HasValue && condition.SpecifyPeriodTo.HasValue &&
                    condition.SpecifyPeriodFrom.Value.CompareTo(condition.SpecifyPeriodTo.Value) > 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090, null, new string[] { "dateSearchPeriodFrom", "dateSearchPeriodTo" });
                }

                if (res.IsError)
                {
                    return(Json(res));
                }

                CommonUtil c = new CommonUtil();
                condition.ContractCode        = c.ConvertContractCode(condition.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                condition.QuotationTargetCode = c.ConvertQuotationTargetCode(condition.QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                IARHandler      hand = ServiceContainer.GetService <IARHandler>() as IARHandler;
                List <dtARList> list = hand.SearchARList(condition);
                CommonUtil.MappingObjectLanguage <dtARList>(list);

                MiscTypeMappingList miscMapList = new MiscTypeMappingList();
                miscMapList.AddMiscType(list.ToArray());
                ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                comh.MiscTypeMappingList(miscMapList);

                foreach (var ar in list)
                {
                    setColStyle(ar);
                }

                string xml = CommonUtil.ConvertToXml <dtARList>(list, "Contract\\CTS360", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                res.ResultData = xml;
            } catch (Exception ex) {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Search AR by role when change mode to "Requester List Mode", "Approver List Mode", or "Auditor List Mode"
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public ActionResult CTS360_ARListByRole(doSearchARListByRole condition)
        {
            ObjectResultData res = new ObjectResultData();

            try {
                if (condition.ARSpecifyPeriod == null && (condition.ARSpecifyPeriodFrom.HasValue || condition.ARSpecifyPeriodTo.HasValue))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0116, null, new string[] { "cboARSpecifyPeriod" });
                }

                if (condition.ARSpecifyPeriod != null &&
                    condition.ARSpecifyPeriodFrom != null && condition.ARSpecifyPeriodTo != null &&
                    condition.ARSpecifyPeriodFrom.Value.CompareTo(condition.ARSpecifyPeriodTo.Value) > 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090, null, new string[] { "dateByRoldPeriodFrom", "dateByRolePeriodTo" });
                }

                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                IARHandler      hand = ServiceContainer.GetService <IARHandler>() as IARHandler;
                List <dtARList> list = hand.GetARListByRole(condition);
                CommonUtil.MappingObjectLanguage <dtARList>(list);

                MiscTypeMappingList miscMapList = new MiscTypeMappingList();
                miscMapList.AddMiscType(list.ToArray());
                ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                comh.MiscTypeMappingList(miscMapList);

                foreach (var ar in list)
                {
                    setColStyle(ar);
                }

                string xml = CommonUtil.ConvertToXml <dtARList>(list, "Contract\\CTS360", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                res.ResultData = xml;
            } catch (Exception ex) {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Exemplo n.º 5
0
        public ActionResult CTS390_searchAR(string summaryPeriod)
        {
            ObjectResultData res = new ObjectResultData();

            try {
                doSummaryARPeriod  condition = CTS390_getPeriodDate(summaryPeriod);
                IARHandler         hand      = ServiceContainer.GetService <IARHandler>() as IARHandler;
                List <dtSummaryAR> summary   = hand.SummaryAR(condition.dateFrom, condition.dateTo, condition.current);
                CommonUtil.MappingObjectLanguage <dtSummaryAR>(summary);

                string xml = CommonUtil.ConvertToXml <dtSummaryAR>(summary, "Contract\\CTS390", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                xml            = xml.Replace("&amp;amp;nbsp;", "&amp;nbsp;"); //decode &nbsp; back
                res.ResultData = xml;
            } catch (Exception ex) {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        ///<summary>
        ///Purpose   : Generate AR approv  no. of Reject
        ///Parameters: strARInteractionType = 05
        ///Expected  : ORD-12-03001
        ///</summary>
        public string Case3()
        {
            IARHandler target = ServiceContainer.GetService <IARHandler>() as IARHandler;
            string     strARInteractionType = "05";

            string expected = "ORD-12-03001";
            string actual;

            try
            {
                actual = target.GenerateARApproveNo(strARInteractionType);
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 3, expected, actual, CompareResult_String(expected, actual)));
        }