Example #1
0
        public ActionResult CMS270_SearchResponse(doBillingClientSearchCondition cond)
        {
            List <dtBillingClientDataForSearch> list = new List <dtBillingClientDataForSearch>();
            List <View_dtBillingClientData>     nlst = new List <View_dtBillingClientData>();

            ObjectResultData res = new ObjectResultData();


            // 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);


            CommonUtil c = new CommonUtil();


            try
            {
                cond.BillingClientCode = c.ConvertBillingClientCode(cond.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG);

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


                    IMasterHandler handler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
                    list = handler.GetBillingClientDataForSearch(cond);

                    foreach (dtBillingClientDataForSearch l in list)
                    {
                        nlst.Add(CommonUtil.CloneObject <dtBillingClientDataForSearch, View_dtBillingClientData>(l));
                    }
                }
            }
            catch (Exception ex)
            {
                nlst            = new List <View_dtBillingClientData>();
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

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