Ejemplo n.º 1
0
        ///// <summary>
        ///// Get billing temp from specified fee type
        ///// </summary>
        ///// <param name="contractCode"></param>
        ///// <param name="occ"></param>
        ///// <param name="billingType"></param>
        ///// <param name="billingTiming"></param>
        ///// <returns></returns>
        //public List<tbt_BillingTemp> GetFee(string contractCode, string occ, string billingType, string billingTiming)
        //{
        //    try
        //    {
        //        //ApplicationErrorException.CheckMandatoryField(billing);
        //        return new List<tbt_BillingTemp>();
        //    }
        //    catch (Exception)
        //    {
        //        throw;
        //    }
        //}

        /// <summary>
        /// Update flag in billing temp when already send to billing module
        /// </summary>
        /// <param name="ContractCode"></param>
        /// <param name="SequenceNo"></param>
        /// <param name="OCC"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> UpdateSendFlag(string ContractCode, int SequenceNo, string OCC) //Add OCC by Jutarat A. on 05102012
        {
            try
            {
                //Validate data input
                //1.1	ContractCode is required.
                doBillingTempData billing = new doBillingTempData();
                billing.ContractCode = ContractCode;
                ApplicationErrorException.CheckMandatoryField(billing);

                //2.	Update billing temp data.
                //Update data to DB
                List <tbt_BillingTemp> updatedList = base.UpdateSendFlag(ContractCode, SequenceNo, OCC, //Add OCC by Jutarat A. on 05102012
                                                                         BillingTemp.C_BILLINGTEMP_FLAG_SENT,
                                                                         CommonUtil.dsTransData.dtOperationData.ProcessDateTime,
                                                                         CommonUtil.dsTransData.dtUserData.EmpNo);

                //Insert Log
                if (updatedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Update;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(updatedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(updatedList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get billing detail data from billing temp
        /// </summary>
        /// <param name="ContractCode"></param>
        /// <param name="OCC"></param>
        /// <param name="BillingTypeList"></param>
        /// <param name="BillingTimingList"></param>
        /// <returns></returns>
        public List <doBillingTempDetail> GetBillingDetailData(string ContractCode, string OCC, List <string> BillingTypeList, List <string> BillingTimingList)
        {
            try
            {
                //Validate data input
                //1.1	ContractCode is required.
                doBillingTempData billing = new doBillingTempData();
                billing.ContractCode = ContractCode;
                ApplicationErrorException.CheckMandatoryField(billing);

                string strBillingType = null;
                if (BillingTypeList != null)
                {
                    strBillingType = CommonUtil.CreateCSVString(BillingTypeList);
                }

                string strBillingTiming = null;
                if (BillingTimingList != null)
                {
                    strBillingTiming = CommonUtil.CreateCSVString(BillingTimingList);
                }

                //Get data from DB
                List <doBillingTempDetail> detailList
                    = base.GetBillingDetailData(
                          ContractCode, OCC, strBillingType, strBillingTiming, BillingTemp.C_BILLINGTEMP_FLAG_KEEP);

                return(detailList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Delete data in billing temp when data is send
        /// </summary>
        /// <param name="ContractCode"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> DeleteAllSendData(string ContractCode)
        {
            try
            {
                //Validate data input
                //1.1	ContractCode is required.
                doBillingTempData billing = new doBillingTempData();
                billing.ContractCode = ContractCode;
                ApplicationErrorException.CheckMandatoryField(billing);

                //Delete data from DB
                List <tbt_BillingTemp> deletedList = base.DeleteAllSendData(ContractCode, BillingTemp.C_BILLINGTEMP_FLAG_KEEP);

                //Insert Log
                if (deletedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Delete;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(deletedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(deletedList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Insert customer group
        /// </summary>
        /// <param name="groupList"></param>
        /// <returns></returns>
        public int InsertCustomerGroup(List <dtCustomeGroupData> groupList)
        {
            try
            {
                List <tbm_CustomerGroup> gLst = CommonUtil.ClonsObjectList <dtCustomeGroupData, tbm_CustomerGroup>(groupList);

                dsTransDataModel dsTrans = CommonUtil.dsTransData;
                foreach (tbm_CustomerGroup group in gLst)
                {
                    ApplicationErrorException.CheckMandatoryField <tbm_CustomerGroup, dtCustomerGroupDataCondition>(group);

                    group.CreateDate = dsTrans.dtOperationData.ProcessDateTime;
                    group.CreateBy   = dsTrans.dtUserData.EmpNo;
                    group.UpdateDate = dsTrans.dtOperationData.ProcessDateTime;
                    group.UpdateBy   = dsTrans.dtUserData.EmpNo;
                }

                List <tbm_CustomerGroup> lst = InsertCustomerGroup(CommonUtil.ConvertToXml_Store <tbm_CustomerGroup>(gLst));
                return(lst.Count);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
        public List <tbm_Site> DeleteSite(doSite site)
        {
            try
            {
                ApplicationErrorException.CheckMandatoryField <doSite, tbm_SiteCondition>(site);

                //Check whether this record is the most updated data
                List <doGetTbm_Site> sList = this.GetTbm_Site(site.SiteCode);
                if (DateTime.Compare(sList[0].UpdateDate.Value, site.UpdateDate.Value) != 0)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0019);
                }

                List <tbm_Site> lst = this.DeleteSite(site.SiteCode);

                //Insert Log
                if (lst.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Delete;
                    logData.TableName       = TableName.C_TBL_NAME_SITE;
                    logData.TableData       = CommonUtil.ConvertToXml(lst);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(lst);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Delete billing temp data by key
        /// </summary>
        /// <param name="strContractCode"></param>
        /// <param name="strOCC"></param>
        /// <param name="iSequenceNo"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> DeleteBillingTempByKey(string ContractCode, string OCC, int iSequenceNo)
        {
            try
            {
                //Validate data input
                //1.1	ContractCode, OCC and SequenceNo are required.
                doBillingTempDataCheckContractSequence billing = new doBillingTempDataCheckContractSequence();
                billing.ContractCode = ContractCode;
                billing.OCC          = OCC;
                billing.SequenceNo   = iSequenceNo;
                ApplicationErrorException.CheckMandatoryField(billing);

                //Delete data from DB
                List <tbt_BillingTemp> deletedList
                    = base.DeleteTbt_BillingTemp_ByKey(ContractCode, OCC, iSequenceNo);

                //Insert Log
                if (deletedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Delete;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(deletedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(deletedList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        public List <tbm_Site> InsertSite(doSite site)
        {
            try
            {
                //set CreateDate, CreateBy, UpdateDate and UpdateBy
                dsTransDataModel dsTrans = CommonUtil.dsTransData;
                site.CreateDate = dsTrans.dtOperationData.ProcessDateTime;
                site.CreateBy   = dsTrans.dtUserData.EmpNo;
                site.UpdateDate = dsTrans.dtOperationData.ProcessDateTime;
                site.UpdateBy   = dsTrans.dtUserData.EmpNo;

                ApplicationErrorException.CheckMandatoryField <doSite, tbm_SiteCondition>(site);

                List <tbm_Site> lst = this.InsertSite(site.SiteCode,
                                                      site.CustCode,
                                                      site.SiteNo,
                                                      site.SiteNameEN,
                                                      site.SiteNameLC,
                                                      site.SECOMContactPerson,
                                                      site.PersonInCharge,
                                                      site.PhoneNo,
                                                      site.BuildingUsageCode,
                                                      site.AddressEN,
                                                      site.AlleyEN,
                                                      site.RoadEN,
                                                      site.SubDistrictEN,
                                                      site.AddressFullEN,
                                                      site.AddressLC,
                                                      site.AlleyLC,
                                                      site.RoadLC,
                                                      site.SubDistrictLC,
                                                      site.AddressFullLC,
                                                      site.DistrictCode,
                                                      site.ProvinceCode,
                                                      site.ZipCode,
                                                      site.CreateDate,
                                                      site.CreateBy,
                                                      site.UpdateDate,
                                                      site.UpdateBy);
                //Insert Log
                if (lst.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Insert;
                    logData.TableName       = TableName.C_TBL_NAME_SITE;
                    logData.TableData       = CommonUtil.ConvertToXml(lst);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(lst);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Get contract same site list
        /// </summary>
        /// <param name="pSiteCode"></param>
        /// <param name="pContractCode"></param>
        /// <returns></returns>
        public List <dtContractsSameSite> GetContractsSameSiteList(string SiteCode, string ContractCode)
        {
            //Check mandatory data SiteCode
            doContractSite contractSite = new doContractSite();

            contractSite.SiteCode = SiteCode;
            ApplicationErrorException.CheckMandatoryField(contractSite);

            return(base.GetContractsSameSiteList(SiteCode, MiscType.C_RENTAL_CHANGE_TYPE, MiscType.C_SALE_CHANGE_TYPE, ServiceType.C_SERVICE_TYPE_RENTAL, ContractCode));
        }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="billingClient"></param>
        /// <returns></returns>
        public List <tbm_BillingClient> InsertBillingClient(tbm_BillingClient billingClient)
        {
            try
            {
                //1.	Check Mandatory Fields for input parameter.
                //BillingClientCode, CustTypeCode, NameEN, NameLC, AddressEN, AddressLC
                ApplicationErrorException.CheckMandatoryField <tbm_BillingClient, tbm_BillingClientCondition>(billingClient);

                dsTransDataModel dsTrans = CommonUtil.dsTransData;
                billingClient.CreateDate = dsTrans.dtOperationData.ProcessDateTime;
                billingClient.CreateBy   = dsTrans.dtUserData.EmpNo;
                billingClient.UpdateDate = dsTrans.dtOperationData.ProcessDateTime;
                billingClient.UpdateBy   = dsTrans.dtUserData.EmpNo;

                List <tbm_BillingClient> insertList = this.InsertBillingClient(billingClient.BillingClientCode,
                                                                               billingClient.NameEN,
                                                                               billingClient.NameLC,
                                                                               billingClient.FullNameEN,
                                                                               billingClient.FullNameLC,
                                                                               billingClient.BranchNo,
                                                                               billingClient.BranchNameEN,
                                                                               billingClient.BranchNameLC,
                                                                               billingClient.CustTypeCode,
                                                                               billingClient.CompanyTypeCode,
                                                                               billingClient.BusinessTypeCode,
                                                                               billingClient.PhoneNo,
                                                                               billingClient.IDNo,
                                                                               billingClient.RegionCode,
                                                                               billingClient.AddressEN,
                                                                               billingClient.AddressLC,
                                                                               billingClient.CreateDate,
                                                                               billingClient.CreateBy,
                                                                               billingClient.UpdateDate,
                                                                               billingClient.UpdateBy,
                                                                               billingClient.DeleteFlag);
                //Insert Log
                if (insertList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Insert;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_CLIENT;
                    logData.TableData       = CommonUtil.ConvertToXml(insertList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(insertList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Delete customer group
        /// </summary>
        /// <param name="groupList"></param>
        /// <returns></returns>
        public int DeleteCustomerGroup(List <dtCustomeGroupData> groupList)
        {
            try
            {
                foreach (dtCustomeGroupData group in groupList)
                {
                    ApplicationErrorException.CheckMandatoryField <dtCustomeGroupData, dtCustomerGroupDataCondition>(group);
                }

                List <tbm_CustomerGroup> lst = this.DeleteCustomerGroup(CommonUtil.ConvertToXml_Store <dtCustomeGroupData>(groupList));
                return(lst.Count);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Update billing temp data by billing client code and office
        /// </summary>
        /// <param name="strContractCode"></param>
        /// <param name="strBillingClientCode"></param>
        /// <param name="strBillingOfficeCode"></param>
        /// <param name="strBillingOCC"></param>
        /// <param name="strBillingTargetCode"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> UpdateBillingTempByBillingClientAndOffice(string ContractCode, string BillingClientCode, string BillingOfficeCode, string BillingOCC, string BillingTargetCode)
        {
            try
            {
                //Validate data input
                //1.1	All parameters IN are required.
                #region validate data
                doBillingTempData_UpdateBillingClientAndOffice updateDo = new doBillingTempData_UpdateBillingClientAndOffice();
                updateDo.ContractCode      = ContractCode;
                updateDo.BillingClientCode = BillingClientCode;
                updateDo.BillingOfficeCode = BillingOfficeCode;
                updateDo.BillingOCC        = BillingOCC;
                updateDo.BillingTargetCode = BillingTargetCode;
                ApplicationErrorException.CheckMandatoryField(updateDo);
                #endregion

                //Update data to DB
                List <tbt_BillingTemp> updatedList
                    = base.UpdateTbt_BillingTemp_ByBillingClientAndOffice(
                          BillingOCC, BillingTargetCode, ContractCode, BillingClientCode, BillingOfficeCode,
                          CommonUtil.dsTransData.dtOperationData.ProcessDateTime,
                          CommonUtil.dsTransData.dtUserData.EmpNo);

                //Insert Log
                if (updatedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Update;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(updatedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(updatedList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Update data in case new/add sale and will insert new occurrence in case other installation type.
        /// </summary>
        /// <param name="doComplete"></param>
        public void CompleteInstallation(doCompleteInstallationData doComplete)
        {
            try
            {
                //Validation ServiceTypeCode and CompleteInstallationProcessFlag
                ApplicationErrorException.CheckMandatoryField <doCompleteInstallationData, doCompleteContractCompleteInstallation>(doComplete);

                //2. Check service type code and complete process flag
                if (doComplete.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL)
                {
                    if (doComplete.CompleteInstallationProcessFlag == FlagType.C_FLAG_ON)
                    {
                        IRentralContractHandler hand = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler;
                        hand.CompleteInstallation(doComplete);
                    }
                    else if (doComplete.CompleteInstallationProcessFlag == FlagType.C_FLAG_OFF)
                    {
                        //do nothing
                    }
                }
                else if (doComplete.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE)
                {
                    ISaleContractHandler hand = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;
                    if (doComplete.CompleteInstallationProcessFlag == FlagType.C_FLAG_ON)
                    {
                        hand.CompleteInstallation(doComplete);
                    }
                    else if (doComplete.CompleteInstallationProcessFlag == FlagType.C_FLAG_OFF)
                    {
                        hand.CancelInstallation(doComplete);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Get billing basic data from billing temp
        /// </summary>
        /// <param name="ContractCode"></param>
        /// <param name="OCC"></param>
        /// <param name="BillingTypeList"></param>
        /// <param name="BillingTimingList"></param>
        /// <returns></returns>
        public List <doBillingTempBasic> GetBillingBasicData(string ContractCode, string OCC, List <string> BillingTypeList, List <string> BillingTimingList)
        {
            try
            {
                //Validate data input
                //1.1	ContractCode is required.
                doBillingTempData billing = new doBillingTempData();
                billing.ContractCode = ContractCode;
                ApplicationErrorException.CheckMandatoryField(billing);

                string strBillingType = null;
                if (BillingTypeList != null)
                {
                    strBillingType = CommonUtil.CreateCSVString(BillingTypeList);
                }

                string strBillingTiming = null;
                if (BillingTimingList != null)
                {
                    strBillingTiming = CommonUtil.CreateCSVString(BillingTimingList);
                }

                //Get data from DB
                List <doBillingTempBasic> basicList
                    = base.GetBillingBasicData(
                          ContractCode, OCC, strBillingType, strBillingTiming
                          //, SECOM_AJIS.Common.Util.ConstantValue.ContractBillingType.C_CONTRACT_BILLING_TYPE_SALE_PRICE
                          , SECOM_AJIS.Common.Util.ConstantValue.ContractBillingType.C_CONTRACT_BILLING_TYPE_PRODUCT_PRICE
                          , BillingTemp.C_BILLINGTEMP_FLAG_KEEP
                          , SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_LOCAL);

                return(basicList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Write history of downloaded document log
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public int WriteDocumentDownloadLog(doDocumentDownloadLog cond)
        {
            try
            {
                int iResult = -1000;

                ApplicationErrorException.CheckMandatoryField(cond);

                using (TransactionScope t = new TransactionScope())
                {
                    // do stuff... update, delete
                    iResult = base.WriteDocumentDownloadLog(cond.DocumentNo, cond.DocumentCode, cond.DownloadDate, cond.DownloadBy, cond.DocumentOCC);

                    t.Complete();
                }

                return(iResult);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// For change billing target from CTS130: CP-16 change customer name and address
        /// </summary>
        /// <param name="strContractCode"></param>
        /// <param name="strOldBillingClientCode"></param>
        /// <param name="strOldBillingOfficeCode"></param>
        /// <param name="strOldBillingTargetCode"></param>
        /// <param name="strNewBillingClientCode"></param>
        /// <param name="strNewBillingOfficeCode"></param>
        /// <param name="strNewBillingTargetCode"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> UpdateBillingTempByBillingTarget(string ContractCode, string strOldBillingClientCode, string strOldBillingOfficeCode, string strOldBillingTargetCode, string strNewBillingClientCode, string strNewBillingOfficeCode, string strNewBillingTargetCode)
        {
            try
            {
                //Validate data input
                //1.1	ContractCode is required.
                doBillingTempData billing = new doBillingTempData();
                billing.ContractCode = ContractCode;
                ApplicationErrorException.CheckMandatoryField(billing);

                //Update data to DB
                List <tbt_BillingTemp> updatedList
                    = base.UpdateTbt_BillingTemp_ByBillingTarget(
                          strNewBillingClientCode, strNewBillingOfficeCode, strNewBillingTargetCode,
                          strOldBillingClientCode, strOldBillingOfficeCode, strOldBillingTargetCode, ContractCode,
                          CommonUtil.dsTransData.dtOperationData.ProcessDateTime,
                          CommonUtil.dsTransData.dtUserData.EmpNo,
                          BillingTemp.C_BILLINGTEMP_FLAG_KEEP);

                //Insert Log
                if (updatedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Update;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(updatedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(updatedList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Update billing temp data by key
        /// </summary>
        /// <param name="billing"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> UpdateBillingTempByKey(tbt_BillingTemp billing)
        {
            try
            {
                //Validate data input
                //1.1	ContractCode, OCC and SequenceNo are required
                //1.3	BillingType, BillingAmount, PaymentMethod are required.
                #region validate input
                ApplicationErrorException.CheckMandatoryField <tbt_BillingTemp, doBillingTempData_Update>(billing);

                //1.2	At least one of (BllingOCC, BillingTargetCode, BillingClientCode)
                List <String> fieldList = new List <string>();

                if (CommonUtil.IsNullOrEmpty(billing.BillingOCC))
                {
                    fieldList.Add("BillingOCC");
                }

                if (CommonUtil.IsNullOrEmpty(billing.BillingTargetCode))
                {
                    fieldList.Add("BillingTargetCode");
                }

                //Modify by Jutarat A. on 13112013

                /*if (CommonUtil.IsNullOrEmpty(billing.BillingClientCode))
                 * {
                 *  //fieldList.Add("BillingClientCode");
                 * }*/
                if (CommonUtil.IsNullOrEmpty(billing.BillingClientCode) && CommonUtil.IsNullOrEmpty(billing.BillingOfficeCode))
                {
                    if (CommonUtil.IsNullOrEmpty(billing.BillingClientCode))
                    {
                        fieldList.Add("BillingClientCode");
                    }

                    if (CommonUtil.IsNullOrEmpty(billing.BillingOfficeCode))
                    {
                        fieldList.Add("BillingOfficeCode");
                    }
                }
                //End Modify

                if (fieldList.Count >= 3) //== 3 //Modify by Jutarat A. on 13112013
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, fieldList.ToArray <String>());
                }
                #endregion

                //Update data to DB
                List <tbt_BillingTemp> updatedList
                    = base.UpdateTbt_BillingTemp_ByKey(billing.BillingOCC
                                                       , billing.BillingTargetRunningNo
                                                       , billing.BillingClientCode
                                                       , billing.BillingTargetCode
                                                       , billing.BillingOfficeCode
                                                       , billing.BillingType
                                                       , billing.CreditTerm
                                                       , billing.BillingTiming
                                                       , billing.BillingAmt
                                                       , billing.PayMethod
                                                       , billing.BillingCycle
                                                       , billing.CalDailyFeeStatus
                                                       , billing.SendFlag
                                                       , billing.ContractCode
                                                       , billing.OCC
                                                       , billing.SequenceNo
                                                       , CommonUtil.dsTransData.dtOperationData.ProcessDateTime
                                                       , CommonUtil.dsTransData.dtUserData.EmpNo
                                                       , billing.BillingAmtCurrencyType
                                                       , billing.BillingAmtUsd);

                //Insert Log
                if (updatedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Update;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(updatedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(updatedList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Validate customer data
        /// </summary>
        /// <param name="cust"></param>
        /// <param name="isFullValidate"></param>
        public void ValidateCustomerData(doCustomer cust, bool isFullValidate = false)
        {
            IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
            ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

            doCompanyType cType = null;

            cust.ValidateCustomerData = true;
            try
            {
                #region Set Misc Data

                MiscTypeMappingList miscList = new MiscTypeMappingList();
                miscList.AddMiscType(cust);
                chandler.MiscTypeMappingList(miscList);

                #endregion
                #region Company Type

                List <doCompanyType> clst = mhandler.GetCompanyType(cust.CompanyTypeCode);
                if (clst.Count > 0)
                {
                    cType = clst[0];
                    cust.CompanyTypeName = clst[0].CompanyTypeName;
                }

                #endregion
                #region Nationality Data

                if (CommonUtil.IsNullOrEmpty(cust.RegionCode) == false)
                {
                    List <tbm_Region> nlst = mhandler.GetTbm_Region();
                    if (nlst.Count > 0)
                    {
                        foreach (tbm_Region r in nlst)
                        {
                            if (cust.RegionCode == r.RegionCode)
                            {
                                cust.Nationality = r.Nationality;
                                break;
                            }
                        }
                    }
                }

                #endregion
                #region BusinessType Data

                if (CommonUtil.IsNullOrEmpty(cust.BusinessTypeCode) == false)
                {
                    List <tbm_BusinessType> blst = mhandler.GetTbm_BusinessType();
                    if (blst.Count > 0)
                    {
                        foreach (tbm_BusinessType b in blst)
                        {
                            if (cust.BusinessTypeCode == b.BusinessTypeCode)
                            {
                                cust.BusinessTypeName = b.BusinessTypeName;
                                break;
                            }
                        }
                    }
                }

                #endregion
                #region Province Data

                if (CommonUtil.IsNullOrEmpty(cust.ProvinceCode) == false)
                {
                    List <tbm_Province> plst = mhandler.GetTbm_Province();
                    if (plst.Count > 0)
                    {
                        foreach (tbm_Province pv in plst)
                        {
                            if (cust.ProvinceCode == pv.ProvinceCode)
                            {
                                cust.ProvinceNameEN = pv.ProvinceNameEN;
                                cust.ProvinceNameLC = pv.ProvinceNameLC;
                                break;
                            }
                        }
                    }
                }

                #endregion
                #region District

                if (CommonUtil.IsNullOrEmpty(cust.DistrictCode) == false)
                {
                    List <tbm_District> dlst = mhandler.GetTbm_District(cust.ProvinceCode);
                    if (dlst.Count > 0)
                    {
                        foreach (tbm_District d in dlst)
                        {
                            if (cust.ProvinceCode == d.ProvinceCode &&
                                cust.DistrictCode == d.DistrictCode)
                            {
                                cust.DistrictNameEN = d.DistrictNameEN;
                                cust.DistrictNameLC = d.DistrictNameLC;
                                break;
                            }
                        }
                    }
                }

                #endregion

                if (CommonUtil.IsNullOrEmpty(cust.CustTypeName) || cust.CustTypeCode != CustomerType.C_CUST_TYPE_JURISTIC)
                {
                    cust.CompanyTypeName = null;
                }
                if (CommonUtil.IsNullOrEmpty(cust.CompanyTypeName) || cust.CompanyTypeCode != CompanyType.C_COMPANY_TYPE_PUBLIC_CO_LTD)
                {
                    cust.FinancialMaketTypeName = null;
                }

                if (CommonUtil.IsNullOrEmpty(cust.CustCode))
                {
                    if (isFullValidate)
                    {
                        ApplicationErrorException.CheckMandatoryField <doCustomer, ValidateCustomer_Full>(cust);
                    }
                    else if (CommonUtil.IsNullOrEmpty(cust.CustCode) == true)
                    {
                        ApplicationErrorException.CheckMandatoryField <doCustomer, ValidateCustomer_CodeNull>(cust);
                    }
                    else
                    {
                        ApplicationErrorException.CheckMandatoryField <doCustomer, ValidateCustomer>(cust);
                    }
                }
            }
            catch
            {
                cust.ValidateCustomerData = false;
            }
            try
            {
                if (cType == null)
                {
                    cType = new doCompanyType();
                }

                cust.CustFullNameEN =
                    CommonUtil.TextList(new string[] { cType.CustNamePrefixEN,
                                                       cust.CustNameEN,
                                                       cType.CustNameSuffixEN }, " ");
                cust.CustFullNameLC =
                    CommonUtil.TextList(new string[] { cType.CustNamePrefixLC,
                                                       cust.CustNameLC,
                                                       cType.CustNameSuffixLC }, " ");

                mhandler.CreateAddressFull(cust);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 18
0
        public void ValidateSiteData(doSite doSite)
        {
            if (doSite == null)
            {
                return;
            }

            doSite.ValidateSiteData = true;
            try
            {
                IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
                ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

                #region Building Usage

                if (CommonUtil.IsNullOrEmpty(doSite.BuildingUsageCode) == false)
                {
                    List <tbm_BuildingUsage> blst = mhandler.GetTbm_BiuldingUsage();
                    if (blst.Count > 0)
                    {
                        foreach (tbm_BuildingUsage b in blst)
                        {
                            if (doSite.BuildingUsageCode == b.BuildingUsageCode)
                            {
                                doSite.BuildingUsageName   = b.BuildingUsageName;
                                doSite.BuildingUsageNameEN = b.BuildingUsageNameEN;
                                doSite.BuildingUsageNameLC = b.BuildingUsageNameLC;
                                doSite.BuildingUsageNameJP = b.BuildingUsageNameJP;
                                break;
                            }
                        }
                    }
                }

                #endregion
                #region Province Data

                if (CommonUtil.IsNullOrEmpty(doSite.ProvinceCode) == false)
                {
                    List <tbm_Province> plst = mhandler.GetTbm_Province();
                    if (plst.Count > 0)
                    {
                        foreach (tbm_Province pv in plst)
                        {
                            if (doSite.ProvinceCode == pv.ProvinceCode)
                            {
                                doSite.ProvinceNameEN = pv.ProvinceNameEN;
                                doSite.ProvinceNameLC = pv.ProvinceNameLC;
                                break;
                            }
                        }
                    }
                }

                #endregion
                #region District

                if (CommonUtil.IsNullOrEmpty(doSite.DistrictCode) == false)
                {
                    List <tbm_District> dlst = mhandler.GetTbm_District(doSite.ProvinceCode);
                    if (dlst.Count > 0)
                    {
                        foreach (tbm_District d in dlst)
                        {
                            if (doSite.ProvinceCode == d.ProvinceCode &&
                                doSite.DistrictCode == d.DistrictCode)
                            {
                                doSite.DistrictNameEN = d.DistrictNameEN;
                                doSite.DistrictNameLC = d.DistrictNameLC;
                                break;
                            }
                        }
                    }
                }

                #endregion

                ApplicationErrorException.CheckMandatoryField <doSite, ValidateSite>(doSite);
            }
            catch
            {
                doSite.ValidateSiteData = false;
            }
            try
            {
                doCustomer cust = CommonUtil.CloneObject <doSite, doCustomer>(doSite);

                IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
                mhandler.CreateAddressFull(cust);

                doSite.AddressFullEN = cust.AddressFullEN;
                doSite.AddressFullLC = cust.AddressFullLC;
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Using when Inventory stock-out intrument by project code
        /// </summary>
        /// <param name="strProjectCode"></param>
        /// <param name="doInstrumentList"></param>
        /// <param name="strStockOutMemo"></param>
        public void UpdateStockOutInstrument(string strProjectCode, List <doInstrument> doInstrumentList, string strStockOutMemo)
        {
            try
            {
                //1.	Check mandatory data
                //strProjectCode and instrument at least 1 are require fields.
                doUpdateStockOutInstrumentData updateDo = new doUpdateStockOutInstrumentData();
                updateDo.ProjectCode = strProjectCode;
                ApplicationErrorException.CheckMandatoryField(updateDo);
                if (CommonUtil.IsNullOrEmpty(strProjectCode))
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "Project Code");
                }
                if (doInstrumentList.Count <= 0)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "Instrument");
                }

                //2.	Begin tran;

                //3.	Validate business
                //3.1	Project code must exist in project table
                List <tbt_Project> projectList = base.GetTbt_Project(strProjectCode);

                //3.1.2.	Check project exist
                //If doTbt_Project	is null Then
                if (projectList.Count <= 0 || projectList[0] == null)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0011, strProjectCode);
                }

                //3.2	Project status must not be ‘Last completed’ or ‘Canceled’
                //3.2.1.	Project status must not be ‘Last completed’
                if (projectList[0].ProjectStatus == ProjectStatus.C_PROJECT_STATUS_LASTCOMPLETE)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3075);
                }

                //3.2.2.	Project status must not be ‘Canceled’
                if (projectList[0].ProjectStatus == ProjectStatus.C_PROJECT_STATUS_CANCEL)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3076);
                }

                //3.3	Check exist in instrument master for all instruments in doInstrumentList
                //3.3.1.	Loop all instrument in doInstrumentList
                IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler;
                foreach (doInstrument doIn in doInstrumentList)
                {
                    //3.3.1.1.	Set local variable
                    // blnExistInstrument = False

                    //3.3.1.2.	Check exist instrument in master
                    List <bool?> blnExistInstrument = hand.CheckExistInstrument(doIn.InstrumentCode);

                    //3.3.1.3.	If blnExistInstrument = False Then
                    if (blnExistInstrument[0].Value == false)
                    {
                        throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0011, doIn.InstrumentCode);
                    }
                }

                using (TransactionScope scope = new TransactionScope())
                {
                    //Prepare insert data
                    tbt_ProjectStockoutInstrument doInsert = new tbt_ProjectStockoutInstrument();
                    doInsert.ProjectCode = strProjectCode;

                    //4.	Insert/update data in project stock-out intrument table
                    //4.1.1.	Loop all instrument in doInstrumentList
                    foreach (doInstrument doIn in doInstrumentList)
                    {
                        //4.1.1.2.	Check exist project stock-out intrument table
                        List <tbt_ProjectStockoutInstrument> doTbt_ProjectStockoutIntrument = this.GetTbt_ProjectStockoutInstrument(strProjectCode, doIn.InstrumentCode);

                        if (doTbt_ProjectStockoutIntrument.Count <= 0)
                        {
                            //4.1.1.3.	In case not exist: insert data to project stock-out intrument table
                            doInsert.InstrumentCode = doIn.InstrumentCode;
                            doInsert.InstrumentQty  = doIn.InstrumentQty;
                            this.InsertTbt_ProjectStockoutInstrument(doInsert);
                        }
                        else
                        {
                            //4.1.1.4.	In case exist: update data to project stock-out intrument table
                            doTbt_ProjectStockoutIntrument[0].InstrumentQty = doTbt_ProjectStockoutIntrument[0].InstrumentQty + doIn.InstrumentQty;
                            this.UpdateTbt_ProjectStockoutInstrument(doTbt_ProjectStockoutIntrument[0]);
                        }
                    }

                    //=============== TRS update 11/06/2012 =======================
                    tbt_ProjectStockOutMemo doStockoutMemo = new tbt_ProjectStockOutMemo();
                    doStockoutMemo.ProjectCode = strProjectCode;
                    doStockoutMemo.Memo        = strStockOutMemo;
                    InsertTbt_ProjectStockOutMemo(doStockoutMemo);
                    //=============================================================

                    scope.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Insert billing temp data
        /// </summary>
        /// <param name="billing"></param>
        /// <returns></returns>
        public List <tbt_BillingTemp> InsertBillingTemp(tbt_BillingTemp billing)
        {
            List <tbt_BillingTemp> insertedList = null;

            try
            {
                //Validate data input
                //1.1	ContractCode and OCC are required.
                //1.3   BillingType, BillingAmount, PaymentMethod are required.
                #region validate input
                ApplicationErrorException.CheckMandatoryField <tbt_BillingTemp, doBillingTempData_Insert>(billing);

                //1.2	At least one of (BillingOCC, BillingTargetCode, BillingClientCode and BillingOfficeCode)
                bool          bBillingOCC              = true;
                bool          bBillingTargetCode       = true;
                bool          bBillingClientOfficeCode = true;
                List <String> fieldList = new List <string>();

                //BillingOCC
                if (CommonUtil.IsNullOrEmpty(billing.BillingOCC))
                {
                    bBillingOCC = false;
                    //fieldList.Add("BillingOCC");
                }

                //BillingTargetCode
                if (CommonUtil.IsNullOrEmpty(billing.BillingTargetCode))
                {
                    bBillingTargetCode = false;
                    //fieldList.Add("BillingTargetCode");
                }

                //BillingClientCode and BillingOfficeCode
                try
                {
                    doBillingBasicCheckBillingClientOfficeCode bClientOfficeCode = new doBillingBasicCheckBillingClientOfficeCode();
                    bClientOfficeCode.ContractCode      = billing.ContractCode;
                    bClientOfficeCode.BillingOfficeCode = billing.BillingOfficeCode;
                    bClientOfficeCode.BillingClientCode = billing.BillingClientCode;
                    ApplicationErrorException.CheckMandatoryField(bClientOfficeCode);
                }
                catch (Exception)
                {
                    bBillingClientOfficeCode = false;
                    //fieldList.Add("BillingOfficeCode");
                    //fieldList.Add("BillingClientCode");
                }

                bool bResult = bBillingOCC || bBillingTargetCode || bBillingClientOfficeCode;
                if (!bResult)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "At least one of BillingOCC, BillingTargetCode, BillingClientCode and BillingOfficeCode");
                }
                #endregion

                //Insert billing temp data to DB
                insertedList = base.InsertTbt_BillingTemp(billing.ContractCode
                                                          , billing.OCC
                                                          , billing.BillingOCC
                                                          , billing.BillingTargetRunningNo
                                                          , billing.BillingClientCode
                                                          , billing.BillingTargetCode
                                                          , billing.BillingOfficeCode
                                                          , billing.BillingType
                                                          , billing.CreditTerm
                                                          , billing.BillingTiming
                                                          , billing.BillingAmt
                                                          , billing.PayMethod
                                                          , billing.BillingCycle
                                                          , billing.CalDailyFeeStatus
                                                          , billing.SendFlag
                                                          , CommonUtil.dsTransData.dtOperationData.ProcessDateTime
                                                          , CommonUtil.dsTransData.dtUserData.EmpNo
                                                          , billing.DocLanguage
                                                          , billing.BillingAmtUsd
                                                          , billing.BillingAmtCurrencyType); //Add by Jutarat A. on 18122013

                //Insert Log
                if (insertedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Insert;
                    logData.TableName       = TableName.C_TBL_NAME_BILLING_TEMP;
                    logData.TableData       = CommonUtil.ConvertToXml(insertedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(insertedList);
        }
Ejemplo n.º 21
0
        public List <tbm_Site> UpdateSite(doSite site)
        {
            try
            {
                ApplicationErrorException.CheckMandatoryField <doSite, tbm_SiteCondition>(site);

                //Check whether this record is the most updated data
                List <doGetTbm_Site> sList = this.GetTbm_Site(site.SiteCode);
                if (DateTime.Compare(sList[0].UpdateDate.Value, site.UpdateDate.Value) != 0)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0019);
                }

                dsTransDataModel dsTrans = CommonUtil.dsTransData;
                site.CreateDate = dsTrans.dtOperationData.ProcessDateTime;
                site.CreateBy   = dsTrans.dtUserData.EmpNo;
                site.UpdateDate = dsTrans.dtOperationData.ProcessDateTime;
                site.UpdateBy   = dsTrans.dtUserData.EmpNo;

                List <tbm_Site> lst = this.UpdateSite(site.SiteCode,
                                                      site.CustCode,
                                                      site.SiteNo,
                                                      site.SiteNameEN,
                                                      site.SiteNameLC,
                                                      site.SECOMContactPerson,
                                                      site.PersonInCharge,
                                                      site.PhoneNo,
                                                      site.BuildingUsageCode,
                                                      site.AddressEN,
                                                      site.AlleyEN,
                                                      site.RoadEN,
                                                      site.SubDistrictEN,
                                                      site.AddressFullEN,
                                                      site.AddressLC,
                                                      site.AlleyLC,
                                                      site.RoadLC,
                                                      site.SubDistrictLC,
                                                      site.AddressFullLC,
                                                      site.DistrictCode,
                                                      site.ProvinceCode,
                                                      site.ZipCode,
                                                      site.UpdateDate,
                                                      site.UpdateBy);

                //Insert Log
                if (lst.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Update;
                    logData.TableName       = TableName.C_TBL_NAME_SITE;
                    logData.TableData       = CommonUtil.ConvertToXml(lst);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(lst);
            }
            catch (Exception)
            {
                throw;
            }
        }