Example #1
0
 /// <summary>
 /// Getting customer data
 /// </summary>
 /// <param name="cond"></param>
 /// <returns></returns>
 public List <dtCustomerData> GetCustomerDataForSearch(doCustomerSearchCondition cond)
 {
     try
     {
         return(base.GetCustomerDataForSearch(cond.CustomerCode,
                                              cond.CustomerName,
                                              cond.CompanyTypeCode,
                                              cond.IDNo,
                                              cond.DummyIDFlag,
                                              cond.RegionCode,
                                              cond.BusinessTypeCode,
                                              cond.Address,
                                              cond.Alley,
                                              cond.Road,
                                              cond.SubDistrict,
                                              cond.DistrictCode,
                                              cond.ProvinceCode,
                                              cond.ZipCode,
                                              cond.TelephoneNo,
                                              cond.GroupName,
                                              MiscType.C_CUST_STATUS,
                                              MiscType.C_CUST_TYPE,
                                              MiscType.C_FINANCIAL_MARKET_TYPE,
                                              cond.CustStatus,         //xmlCustStatus,
                                              cond.CustomerTypeCode)); // xmlCustTypeCode
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// Get customer data by search condition
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult CMS250_SearchResponse(doCustomerSearchCondition cond)
        {
            CommonUtil c = new CommonUtil();

            List <View_dtCustomerData2> nlst = new List <View_dtCustomerData2>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            // Concate string Customer status with commar separate. like ,xx,yy,zz,
            List <string> lstCustStatus = new List <string>();

            lstCustStatus.Add(cond.chkExistCustomer);
            lstCustStatus.Add(cond.chkNewCustomer);
            cond.CustStatus = CommonUtil.CreateCSVString(lstCustStatus);

            // Concate string CustomerTypeCode with commar separate. like ,xx,yy,zz,
            List <string> lstCustomerTypeCode = new List <string>();

            lstCustomerTypeCode.Add(cond.chkJuristic);
            lstCustomerTypeCode.Add(cond.chkIndividual);
            lstCustomerTypeCode.Add(cond.chkAssociation);
            lstCustomerTypeCode.Add(cond.chkPublicOffice);
            lstCustomerTypeCode.Add(cond.chkOther);
            cond.CustomerTypeCode = CommonUtil.CreateCSVString(lstCustomerTypeCode);


            try
            {
                cond.CustomerCode = c.ConvertCustCode(cond.CustomerCode, CommonUtil.CONVERT_TYPE.TO_LONG);

                if (cond.CustStatus == string.Empty)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0054);
                }

                if (cond.CustomerTypeCode == string.Empty)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0055);
                }
                else
                {
                    //if (cond.Counter == 0)
                    //{
                    //    res.ResultData = CommonUtil.ConvertToXml<View_dtCustomerData>(nlst, "Common\\CMS250",CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                    //    return Json(res);
                    //}

                    ICustomerMasterHandler handler = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler;
                    List <dtCustomerData>  list    = handler.GetCustomerDataForSearch(cond);


                    foreach (dtCustomerData l in list)
                    {
                        l.CustCode = c.ConvertCustCode(l.CustCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                        nlst.Add(CommonUtil.CloneObject <dtCustomerData, View_dtCustomerData2>(l));
                    }
                }
            }
            catch (Exception ex)
            {
                nlst            = new List <View_dtCustomerData2>();
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            res.ResultData = CommonUtil.ConvertToXml <View_dtCustomerData2>(nlst, "Common\\CMS250", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            return(Json(res));
        }