Example #1
0
        /// <summary>
        /// Generate billing client code
        /// </summary>
        /// <returns></returns>
        public string GenerateBillingClientCode()
        {
            string strBillingClientCode = string.Empty;

            try
            {
                //1. Get next running no
                ICommonHandler     handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doRunningNo> run     = handler.GetNextRunningCode(NameCode.C_NAME_CODE_BILLING_CLIENT_CODE);

                if (run.Count > 0)
                {
                    string strRunningNo = run[0].RunningNo;

                    //2.	Generate check digit
                    string strCheckDigit = handler.GenerateCheckDigit(strRunningNo);

                    //3.	Set strBillingClientCode =strRunningNo+ strCheckDigit
                    strBillingClientCode = strRunningNo + strCheckDigit;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(strBillingClientCode);
        }
Example #2
0
        /// <summary>
        /// To generate project code
        /// </summary>
        /// <returns></returns>
        public string GenerateProjectCode()
        {
            try
            {
                ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

                //1.	Call method for get next running code
                List <doRunningNo> doRunningNo = null;
                try
                {
                    doRunningNo = hand.GetNextRunningCode(NameCode.C_NAME_CODE_PROJECT_CODE, true);
                }
                catch
                {
                }

                bool isFound = false;
                if (doRunningNo != null)
                {
                    if (doRunningNo.Count > 0)
                    {
                        if (CommonUtil.IsNullOrEmpty(doRunningNo[0].RunningNo) == false)
                        {
                            isFound = true;
                        }
                    }
                }
                if (isFound == false)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3131);
                }

                //2.	Call method for get the check digit
                string strCheckDigit = hand.GenerateCheckDigit(doRunningNo[0].RunningNo);

                //3.	Create project code
                string strProjectCode = ProjectCode.C_PROJECT_CODE_PREFIX + doRunningNo[0].RunningNo + strCheckDigit;

                //4.	Return strProjectCode
                return(strProjectCode);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        /// <summary>
        /// Generate dummy ID
        /// </summary>
        /// <returns></returns>
        public string GenerateDummyID()
        {
            try
            {
                ICommonHandler     hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doRunningNo> run  = hand.GetNextRunningCode(NameCode.C_NAME_CODE_DUMMY_ID);
                if (run.Count > 0)
                {
                    return(CommonValue.C_DUMMY_ID_PREFIX + run[0].RunningNo);
                }

                return(null);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        /// <summary>
        /// Generate customer code
        /// </summary>
        /// <returns></returns>
        public string GenerateCustomerCode()
        {
            try
            {
                ICommonHandler     handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doRunningNo> run     = handler.GetNextRunningCode(NameCode.C_NAME_CODE_CUSTOMER_CODE);
                if (run.Count > 0)
                {
                    string digit = handler.GenerateCheckDigit(run[0].RunningNo);
                    return(CommonValue.C_CUST_CODE_PREFIX + run[0].RunningNo + digit);
                }

                return(null);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Generate unique GroupCode.<br />
        /// - Get next running code.<br />
        /// - Generate check digit.<br />
        /// - Combind GroupCode Prefix + runningNo + check digit
        /// </summary>
        /// <returns></returns>
        public string GenerateGroupCode()
        {
            string strGroupCode = string.Empty;

            //1.	Get next running no
            ICommonHandler     commHand    = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
            List <doRunningNo> runningList = commHand.GetNextRunningCode(NameCode.C_NAME_CODE_GROUP_CODE);

            //2.	Generate check digit
            string strRunningNo = runningList[0].RunningNo;

            if (runningList.Count > 0)
            {
                string strCheckDigit = commHand.GenerateCheckDigit(strRunningNo);
                strGroupCode = GroupCode.C_GROUP_CODE_PREFIX + strRunningNo + strCheckDigit;
            }

            return(strGroupCode);
        }
        /// <summary>
        /// To generate contract code
        /// </summary>
        /// <param name="strProductTypeCode"></param>
        /// <returns></returns>
        public string GenerateContractCode(string strProductTypeCode)
        {
            try
            {
                //1.	Get product type data
                ICommonHandler         hand            = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <tbs_ProductType> productTypeList = hand.GetTbs_ProductType(null, strProductTypeCode);

                //1.2.	Check existing of returned data
                if (productTypeList.Count <= 0 || productTypeList[0].ContractPrefix == null || productTypeList[0].ContractPrefix == string.Empty)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3022);
                }

                //2.	Call method for get next running code
                List <doRunningNo> runningNoList = hand.GetNextRunningCode(NameCode.C_NAME_CODE_CONTRACT_CODE);

                if (runningNoList.Count <= 0 || runningNoList[0].RunningNo == null || runningNoList[0].RunningNo == string.Empty)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3130);
                }

                //3.	Call method for get the check digit
                //3.1.	Call		CommonHandler.GenerateCheckDigit
                string iCheckDigit = hand.GenerateCheckDigit(runningNoList[0].RunningNo);

                //4.	Create contract code
                //4.1.	Set strContractCode = dtTbs_ProductType[0].ContractPrefix + strRunningCode + iCheckDigit
                string strContractCode = productTypeList[0].ContractPrefix + runningNoList[0].RunningNo + iCheckDigit;

                //5.	Return strContractCode
                return(strContractCode);
            }
            catch (Exception)
            {
                throw;
            }
        }