public string[] getListSerialNumberFiltered(int type, string[] area = null, string[] salesoffice = null, string[] customer = null, string[] family = null, string[] industry = null, string[] model = null, string[] serialnumber = null, string repairdatefrom = null, string repairdateto = null, string purchasedatefrom = null, string purchasedateto = null, string deliverydatefrom = null, string deliverydateto = null, string smurangefrom = null, string smurangeto = null, string[] product = null, string[] plant = null, string Hid = "", string Rental = "", string Others = "", string paramsModel = null, string paramsSerialNumber = null, bool btnPOST = false)
 {
     string[] getFinalData;
     if (type == 1)
     {
         getFinalData = _InventoryWeeklyBs.GetSerialNumberFiltered(LimitforSerialNumberFiltered, customer, model, serialnumber, plant, product, paramsModel, paramsSerialNumber).Select(item => item.Serial_Number).Distinct().ToArray();
     }
     else
     {
         if (area.Count() > 0 || salesoffice.Count() > 0 || customer.Count() > 0 || family.Count() > 0 || industry.Count() > 0 || model.Count() > 0 || serialnumber.Count() > 0 || repairdatefrom != "" || repairdateto != "" || purchasedatefrom != "" || purchasedateto != "" || deliverydatefrom != "" || repairdateto != "" || (!String.IsNullOrWhiteSpace(smurangefrom) && smurangefrom != "0") || (!String.IsNullOrWhiteSpace(smurangeto) && smurangeto != "0") || !String.IsNullOrWhiteSpace(Hid) || !String.IsNullOrWhiteSpace(Rental) || !String.IsNullOrWhiteSpace(Others) || !String.IsNullOrWhiteSpace(paramsModel) || !String.IsNullOrWhiteSpace(paramsSerialNumber))
         {
             getFinalData = V_TR_MEP_Bs.GetSerialNumberFiltered(LimitforSerialNumberFiltered, area, salesoffice, customer, family, industry, model, serialnumber, repairdatefrom, repairdateto, purchasedatefrom, purchasedateto, deliverydatefrom, deliverydateto, smurangefrom, smurangeto, Hid, Rental, Others, paramsModel, paramsSerialNumber).Select(item => item.Serial_Number).ToArray();
         }
         else
         {
             if (btnPOST == false)
             {
                 getFinalData = V_TR_MEP_Bs.GetSerialNumberFiltered("0", area, salesoffice, customer, family, industry, model, serialnumber, repairdatefrom, repairdateto, purchasedatefrom, purchasedateto, deliverydatefrom, deliverydateto, smurangefrom, smurangeto, Hid, Rental, Others, paramsModel, paramsSerialNumber).Select(item => item.Serial_Number).Take(0).ToArray();
             }
             else
             {
                 getFinalData = V_TR_MEP_Bs.GetSerialNumberFiltered(LimitforSerialNumberFiltered, area, salesoffice, customer, family, industry, model, serialnumber, repairdatefrom, repairdateto, purchasedatefrom, purchasedateto, deliverydatefrom, deliverydateto, smurangefrom, smurangeto, Hid, Rental, Others, paramsModel, paramsSerialNumber).Select(item => item.Serial_Number).ToArray();
             }
         }
     }
     return(getFinalData);
 }
        public JsonResult GetSerialNumberMEPOverview(string filter, string area, string salesoffice, string customer, string family, string model, string serialnumber, string smurange, string rental = null, string hid = null, string other = null)
        {
            var RespondJson = new AutoSuggestOverviewModel.ResponseJson();
            var Status      = new AutoSuggestOverviewModel.status();;

            var ListData = new List <AutoSuggestOverviewModel.data>();

            Status.code    = 200;
            Status.message = "Success";
            var Result = V_TR_MEP_Bs.GetSerialNumberMEPOverview(filter, area, salesoffice, customer, family, model, serialnumber, rental, hid, other);

            foreach (var item in Result)
            {
                var Data = new AutoSuggestOverviewModel.data();
                Data.value = item.Serial_Number;
                Data.label = item.Serial_Number;
                Data.style = "";
                ListData.Add(Data);
            }
            RespondJson.status = Status;
            RespondJson.data   = ListData;
            return(Json(RespondJson, JsonRequestBehavior.AllowGet));
        }
        // GET: MapDistribution
        
        public ActionResult MapDistribution(FormCollection collection, int type, string Area, string SalesOffice, string Customer, string Family, string Industry, string Model, string SerialNumber, string SmuRangeFrom, string SmuRangeTo, string PurchaseDateFrom, string PurchaseDateEnd, string DeliveryDateFrom, string DeliveryDateEnd, string RepairDateFrom, string RepairDateEnd, string Plant, string Product, string Hid, string Rental, string Other, string paramsModel = null, string paramsSerialNumber = null, bool btnPOST=false)
        {
            string[] SplitArea = new string[] { };
            string[] SplitCustomer = new string[] { };
            string[] SplitFamily = new string[] { };
            string[] SplitSalesOffice = new string[] { };
            string[] SplitModel = new string[] { };
            string[] SplitSerialNumber = new string[] { };
            string[] SplitProduct = new string[] { };
            string[] SplitPlant = new string[] { };
            string[] SplitIndustry = new string[] { };
            if (!string.IsNullOrWhiteSpace(Area))
            {
                SplitArea = Area.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Customer))
            {
                SplitCustomer = Customer.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Model))
            {
                SplitModel = Model.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SerialNumber))
            {
                SplitSerialNumber = SerialNumber.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Family))
            {
                SplitFamily = Family.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Industry))
            {
               SplitIndustry = Industry.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Plant))
            {
                SplitPlant = Plant.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Product))
            {
                SplitProduct = Product.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SalesOffice))
            {
                SplitSalesOffice = SalesOffice.Split(',');
            }
            Rental = Rental.Replace("?model=1", "");
            paramsModel = paramsModel.Replace("?model=1", "");
            paramsSerialNumber = paramsSerialNumber.Replace("?model=1", "");
            var listMarker = new List<MapDistributionModel.Marker>();

            if (type != 1)
            {
                var GetData = V_TR_MEP_Bs.GetDataMapDistribution(btnPOST, SplitArea, SplitSalesOffice, SplitCustomer, SplitFamily,SplitIndustry, SplitModel, SplitSerialNumber, SmuRangeFrom, SmuRangeTo, DeliveryDateFrom, DeliveryDateEnd, PurchaseDateFrom, PurchaseDateEnd, RepairDateFrom, RepairDateEnd, Hid, Rental, Other, paramsModel, paramsSerialNumber).Item1;
                foreach(var Loc in GetData)
                {
                    var listLatLong = new List<double>();
                    double lat1 = Convert.ToDouble(Loc.Lattitude);
                    double long1 = Convert.ToDouble(Loc.Longitude);
                    listLatLong.Add(lat1);
                    listLatLong.Add(long1);

                    var markers = new MapDistributionModel.Marker();
                    markers.LatLong = listLatLong;
                    markers.Name = Loc.Area;
                    markers.Id = Loc.OrganizationId;
                    listMarker.Add(markers);
                }
                var status = new MapDistributionModel.Status();
                status.Code = 200;
                status.Message = "Success";

                var map = new MapDistributionModel.Map();
                map.Marker = listMarker;

                var data = new MapDistributionModel.Data();
                data.Map = map;

                var responseJson = new MapDistributionModel.ResponseJson();
                responseJson.Data = data;
                responseJson.Status = status;

                Response.ContentType = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return new EmptyResult();
            }
            else
            {
                var dataFiltered = getListSerialNumberFiltered(type, customer: SplitCustomer, plant: SplitPlant, serialnumber: SplitSerialNumber, model: SplitModel, product: SplitProduct, paramsModel: paramsModel, paramsSerialNumber: SerialNumber);
                var GetData = _InventoryWeeklyBs.GetDataMapDistribution(dataFiltered).Item1;
                foreach (var Loc in GetData)
                {
                    var listLatLong = new List<double>();
                    double lat1 = Convert.ToDouble(Loc.Lattitude);
                    double long1 = Convert.ToDouble(Loc.Longitude);
                    listLatLong.Add(lat1);
                    listLatLong.Add(long1);

                    var markers = new MapDistributionModel.Marker();
                    markers.LatLong = listLatLong;
                    markers.Name = Loc.Area;
                    markers.Id = Loc.OrganizationId;
                    listMarker.Add(markers);
                }
                var status = new MapDistributionModel.Status();
                status.Code = 200;
                status.Message = "Success";

                var map = new MapDistributionModel.Map();
                map.Marker = listMarker;

                var data = new MapDistributionModel.Data();
                data.Map = map;

                var responseJson = new MapDistributionModel.ResponseJson();
                responseJson.Data = data;
                responseJson.Status = status;

                Response.ContentType = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return new EmptyResult();
            }



            //var listLatLong1 = new List<double>();
            //double lat1 = 5.5483;
            //double long1 = 95.3238;
            //listLatLong1.Add(lat1);
            //listLatLong1.Add(long1);
         

            //var markers1 = new MapDistributionModel.Marker();
            //markers1.LatLong = listLatLong1;
            //markers1.Name = "Aceh";
            //markers1.Id = 1;
         

            //var listMarker = new List<MapDistributionModel.Marker>();
            //listMarker.Add(markers1);

            //var map = new MapDistributionModel.Map();
            //map.Marker = listMarker;

            //var data = new MapDistributionModel.Data();
            //data.Map = map;

         
        }
        // GET: TableModelOverview
        public ActionResult TableModelOverview(FormCollection collection, int type, string Area, string SalesOffice, string Customer, string Family, string Industry, string Model, string SerialNumber, string SmuRangeFrom, string SmuRangeTo, string PurchaseDateFrom, string PurchaseDateEnd, string DeliveryDateFrom, string DeliveryDateEnd, string RepairDateFrom, string RepairDateEnd, string Plant, string Product, string Hid, string Rental, string Others, string paramsModel, string paramsSerialNumber, bool btnPOST = false)
        {
            var orderByColumn = collection["columns[" + collection["order[0][column]"] + "][data]"];
            var orderByDir    = collection["order[0][dir]"];
            var start         = Convert.ToInt32(collection["start"]);
            var length        = Convert.ToInt32(collection["length"]);

            string[] SplitArea         = new string[] { };
            string[] SplitCustomer     = new string[] { };
            string[] SplitFamily       = new string[] { };
            string[] SplitSalesOffice  = new string[] { };
            string[] SplitModel        = new string[] { };
            string[] SplitSerialNumber = new string[] { };
            string[] SplitProduct      = new string[] { };
            string[] SplitPlant        = new string[] { };
            string[] SplitIndustry     = new string[] { };
            if (!string.IsNullOrWhiteSpace(Area))
            {
                SplitArea = Area.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Customer))
            {
                SplitCustomer = Customer.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Model))
            {
                SplitModel = Model.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SerialNumber))
            {
                SplitSerialNumber = SerialNumber.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Family))
            {
                SplitFamily = Family.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Industry))
            {
                SplitIndustry = Industry.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Plant))
            {
                SplitPlant = Plant.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Product))
            {
                SplitProduct = Product.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SalesOffice))
            {
                SplitSalesOffice = SalesOffice.Split(',');
            }
            var RentalVal = Rental.Replace("?model=1", "");

            if (type == 1)
            {
                //var dataFiltered = getListSerialNumberFiltered(type, customer : SplitCustomer, plant :SplitPlant, serialnumber : SplitSerialNumber, model : SplitModel,product : SplitProduct);
                var getData  = _InventoryWeeklyBs.GetMEPTechnicalOverviewBySN(type, SplitCustomer, SplitModel, SplitSerialNumber, SplitPlant, SplitProduct, paramsModel, paramsSerialNumber, orderByDir, orderByColumn, start, length);
                var listItem = new List <TableModelOverviewModel.Data>();
                //Custom Query
                foreach (var item in getData.Item1)
                {
                    var model = new TableModelOverviewModel.ValueData();
                    model.Value = item.Model;
                    model.Style = paramsModel == model.Value ? "<i class='fa fa-arrow-right mr-2'></i>" : "";
                    var countModel = new TableModelOverviewModel.ValueData();
                    countModel.Value = item.CountModel.ToString();
                    countModel.Style = "";
                    var itemData = new TableModelOverviewModel.Data();
                    itemData.Model      = model;
                    itemData.CountModel = countModel;
                    listItem.Add(itemData);
                }
                var status = new TableModelOverviewModel.Status();
                status.Code    = 200;
                status.Message = "Sukses";
                var responseJson = new TableModelOverviewModel.ResponseJson();
                responseJson.Status          = status;
                responseJson.Data            = listItem;
                responseJson.RecordsFiltered = getData.Item2;
                responseJson.RecordsTotal    = getData.Item2;
                Response.ContentType         = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return(new EmptyResult());
            }
            else
            {
                var getData = V_TR_MEP_Bs.GetMEPTechnicalOverview(LimitforSerialNumberFiltered, SplitArea, SplitSalesOffice, SplitCustomer, SplitFamily, SplitIndustry, SplitModel, SplitSerialNumber, SmuRangeFrom, SmuRangeTo, DeliveryDateFrom, DeliveryDateEnd, PurchaseDateFrom, PurchaseDateEnd, RepairDateFrom, RepairDateEnd, Hid, RentalVal, Others, orderByDir, orderByColumn, start, length, paramsModel, paramsSerialNumber, btnPOST);

                var listItem = new List <TableModelOverviewModel.Data>();
                //Custom Query
                foreach (var item in getData.Item1)
                {
                    var model = new TableModelOverviewModel.ValueData();
                    model.Value = item.Model;
                    model.Style = paramsModel == model.Value ? "<i class='fa fa-arrow-right mr-2'></i>" : "";
                    var countModel = new TableModelOverviewModel.ValueData();
                    countModel.Value = item.CountModel.ToString();
                    countModel.Style = "";
                    var itemData = new TableModelOverviewModel.Data();
                    itemData.Model      = model;
                    itemData.CountModel = countModel;
                    listItem.Add(itemData);
                }
                var status = new TableModelOverviewModel.Status();
                status.Code    = 200;
                status.Message = "Sukses";
                var responseJson = new TableModelOverviewModel.ResponseJson();
                responseJson.Status          = status;
                responseJson.Data            = listItem;
                responseJson.RecordsFiltered = getData.Item2;
                responseJson.RecordsTotal    = getData.Item2;
                Response.ContentType         = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return(new EmptyResult());
            }
        }
示例#5
0
        public ActionResult GetTicketOverview(FormCollection collection, int type, string Area, string SalesOffice, string Customer, string Family, string Industry, string Model, string SerialNumber, string SmuRangeFrom, string SmuRangeTo, string PurchaseDateFrom, string PurchaseDateEnd, string DeliveryDateFrom, string DeliveryDateEnd, string RepairDateFrom, string RepairDateEnd, string Plant, string Product, string Hid, string Rental, string Other, string paramsModel = null, string paramsSerialNumber = null, bool btnPOST = false, int download = 0, String[] columns = null)
        {
            var orderByColumn = collection["columns[" + collection["order[0][column]"] + "][data]"];
            var orderByDir    = collection["order[0][dir]"];
            var isDistinct    = true;
            var start         = Convert.ToInt32(collection["start"]);
            var length        = Convert.ToInt32(collection["length"]);

            string[] SplitArea         = new string[] { };
            string[] SplitCustomer     = new string[] { };
            string[] SplitFamily       = new string[] { };
            string[] SplitSalesOffice  = new string[] { };
            string[] SplitModel        = new string[] { };
            string[] SplitSerialNumber = new string[] { };
            string[] SplitProduct      = new string[] { };
            string[] SplitPlant        = new string[] { };
            string[] SplitIndustry     = new string[] { };

            if (!string.IsNullOrWhiteSpace(Area))
            {
                SplitArea = Area.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Customer))
            {
                SplitCustomer = Customer.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Model))
            {
                SplitModel = Model.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SerialNumber))
            {
                SplitSerialNumber = SerialNumber.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Family))
            {
                SplitFamily = Family.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Industry))
            {
                SplitIndustry = Industry.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Plant))
            {
                SplitPlant = Plant.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Product))
            {
                SplitProduct = Product.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SalesOffice))
            {
                SplitSalesOffice = SalesOffice.Split(',');
            }
            var RentalVal = Rental.Replace("?model=1", "");
            var modelData = paramsModel.Replace("?model=1", "");

            paramsSerialNumber = paramsSerialNumber.Replace("?model=1", "");
            if (type == 1)
            {
                //var dataFiltered = getListSerialNumberFiltered(type, customer: SplitCustomer, plant: SplitPlant, serialnumber: SplitSerialNumber, model: SplitModel, product: SplitProduct, paramsModel : paramsModel);
                var getData = _InventoryWeeklyBs.getListMEPbyModel(modelData, SplitCustomer, SplitSerialNumber, SplitPlant, SplitProduct, orderByDir, orderByColumn, start, length, download);

                var listItem = new List <TableMEPOverviewModel.Data>();
                foreach (var item in getData.Item1)
                {
                    var serialnumber = new TableMEPOverviewModel.ValueData();
                    serialnumber.Value = item.Serial_Number;
                    serialnumber.Style = paramsSerialNumber == serialnumber.Value ? "<i class='fa fa-arrow-right'></i>" : "";
                    var smu = new TableMEPOverviewModel.ValueData();
                    smu.Value = Convert.ToString(item.SMU);
                    smu.Style = "";
                    var smuUpdate = new TableMEPOverviewModel.ValueData();
                    smuUpdate.Value = item.SMU_Update;
                    smuUpdate.Style = "";
                    var lastServiced = new TableMEPOverviewModel.ValueData();
                    lastServiced.Value = !String.IsNullOrWhiteSpace(item.LastServiced) ? item.LastServiced : "-";
                    lastServiced.Style = "";
                    var deliveryDate = new TableMEPOverviewModel.ValueData();
                    deliveryDate.Value = (item.DeliveryDate != null ? item.DeliveryDate : "-");
                    deliveryDate.Style = "";
                    var purchaseDate = new TableMEPOverviewModel.ValueData();
                    purchaseDate.Value = (item.PurchaseDate != null ? item.PurchaseDate : "-");
                    purchaseDate.Style = "";
                    var industry = new TableMEPOverviewModel.ValueData();
                    industry.Value = (!String.IsNullOrWhiteSpace(item.Industry) ? item.Industry : "-");
                    industry.Style = "";

                    var itemData = new TableMEPOverviewModel.Data();
                    itemData.SerialNumber  = serialnumber;
                    itemData.SMU           = smu;
                    itemData.SMU_Update    = smuUpdate;
                    itemData.DeliveryDate  = deliveryDate;
                    itemData.Purchase_Date = purchaseDate;
                    itemData.LastServiced  = lastServiced;
                    itemData.Industry      = industry;
                    listItem.Add(itemData);
                }
                var status = new TableMEPOverviewModel.Status();
                status.Code    = 200;
                status.Message = "Sukses";
                var responseJson = new TableMEPOverviewModel.ResponseJson();
                responseJson.Status          = status;
                responseJson.Data            = listItem;
                responseJson.RecordsFiltered = getData.Item2;
                responseJson.RecordsTotal    = getData.Item2;
                Response.ContentType         = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return(new EmptyResult());
            }
            else
            {
                var getData = V_TR_MEP_Bs.getListMEPbyModel(modelData, SplitArea, SplitSalesOffice, SplitCustomer, SplitFamily, SplitIndustry, SplitSerialNumber, SmuRangeFrom, SmuRangeTo, PurchaseDateFrom, PurchaseDateEnd, DeliveryDateFrom, DeliveryDateEnd, RepairDateFrom, RepairDateEnd, SplitPlant, SplitProduct, Hid, RentalVal, orderByDir, orderByColumn, start, length, isDistinct, Other, download);

                var listItem = new List <TableMEPOverviewModel.Data>();
                foreach (var item in getData.Item1)
                {
                    var serialnumber = new TableMEPOverviewModel.ValueData();
                    serialnumber.Value = item.Serial_Number;
                    serialnumber.Style = paramsSerialNumber == serialnumber.Value ? "<i class='fa fa-arrow-right'></i>" : "";
                    var smu = new TableMEPOverviewModel.ValueData();
                    smu.Value = Convert.ToString(item.SMU);
                    smu.Style = "";
                    var smuUpdate = new TableMEPOverviewModel.ValueData();
                    smuUpdate.Value = item.SMU_Update;
                    smuUpdate.Style = "";
                    var lastServiced = new TableMEPOverviewModel.ValueData();
                    lastServiced.Value = !String.IsNullOrWhiteSpace(item.LastServiced) ? item.LastServiced : "-";
                    lastServiced.Style = "";
                    var deliveryDate = new TableMEPOverviewModel.ValueData();
                    deliveryDate.Value = (item.DeliveryDate != null ? item.DeliveryDate : "-");
                    deliveryDate.Style = "";
                    var purchaseDate = new TableMEPOverviewModel.ValueData();
                    purchaseDate.Value = (item.PurchaseDate != null ? item.PurchaseDate : "-");
                    purchaseDate.Style = "";
                    var industry = new TableMEPOverviewModel.ValueData();
                    industry.Value = (!String.IsNullOrWhiteSpace(item.Industry) ? item.Industry : "-");
                    industry.Style = "";

                    var itemData = new TableMEPOverviewModel.Data();
                    itemData.SerialNumber  = serialnumber;
                    itemData.SMU           = smu;
                    itemData.SMU_Update    = smuUpdate;
                    itemData.DeliveryDate  = deliveryDate;
                    itemData.Purchase_Date = purchaseDate;
                    itemData.LastServiced  = lastServiced;
                    itemData.Industry      = industry;
                    listItem.Add(itemData);
                }
                var status = new TableMEPOverviewModel.Status();
                status.Code    = 200;
                status.Message = "Sukses";
                var responseJson = new TableMEPOverviewModel.ResponseJson();
                responseJson.Status          = status;
                responseJson.Data            = listItem;
                responseJson.RecordsFiltered = getData.Item2;
                responseJson.RecordsTotal    = getData.Item2;
                Response.ContentType         = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return(new EmptyResult());
            }
        }
示例#6
0
        public ActionResult TableRelatedCustomerOverview(FormCollection fc, int type, string Area, string SalesOffice, string Customer, string Family, string Industry, string Model, string SerialNumber, string SmuRangeFrom, string SmuRangeTo, string PurchaseDateFrom, string PurchaseDateEnd, string DeliveryDateFrom, string DeliveryDateEnd, string RepairDateFrom, string RepairDateEnd, string Plant, string Product, string Hid, string Rental, string Others, string paramsModel = null, string paramsSerialNumber = null, bool btnPOST = false, int download = 0, String [] columns = null)
        {
            var orderByColumn = fc["columns[" + fc["order[0][column]"] + "][data]"];
            var orderByDir    = fc["order[0][dir]"];
            var start         = Convert.ToInt32(fc["start"]);
            var length        = Convert.ToInt32(fc["length"]);

            string[] SplitArea         = new string[] { };
            string[] SplitCustomer     = new string[] { };
            string[] SplitFamily       = new string[] { };
            string[] SplitSalesOffice  = new string[] { };
            string[] SplitModel        = new string[] { };
            string[] SplitSerialNumber = new string[] { };
            string[] SplitProduct      = new string[] { };
            string[] SplitPlant        = new string[] { };
            string[] SplitIndustry     = new string[] { };
            if (!string.IsNullOrWhiteSpace(Area))
            {
                SplitArea = Area.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Customer))
            {
                SplitCustomer = Customer.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Model))
            {
                SplitModel = Model.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SerialNumber))
            {
                SplitSerialNumber = SerialNumber.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Family))
            {
                SplitFamily = Family.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Industry))
            {
                SplitIndustry = Industry.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Plant))
            {
                SplitPlant = Plant.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Product))
            {
                SplitProduct = Product.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SalesOffice))
            {
                SplitSalesOffice = SalesOffice.Split(',');
            }
            var RentalVal = Rental.Replace("?model=1", "");

            if (type != 1)
            {
                var getData  = V_TR_MEP_Bs.GetRelatedCustomerfromMEPOverview(LimitforSerialNumberFiltered, SplitArea, SplitSalesOffice, SplitCustomer, SplitFamily, SplitIndustry, SplitModel, SplitSerialNumber, SmuRangeFrom, SmuRangeTo, DeliveryDateFrom, DeliveryDateEnd, PurchaseDateFrom, PurchaseDateEnd, RepairDateFrom, RepairDateEnd, Hid, RentalVal, Others, orderByDir, orderByColumn, start, length, paramsModel, paramsSerialNumber, btnPOST, download, columns);
                var listData = new List <TableRelatedCustomerOverviewModel.Data>();
                foreach (var item in getData.Item1)
                {
                    var custId = new TableRelatedCustomerOverviewModel.ValueData();
                    custId.Value = String.IsNullOrWhiteSpace(item.CustomerId) ? "-" : item.CustomerId;
                    custId.Style = "";
                    var custName = new TableRelatedCustomerOverviewModel.ValueData();
                    custName.Value = String.IsNullOrWhiteSpace(item.CustomerName) ? "-" : item.CustomerName;
                    custName.Style = "";
                    var location = new TableRelatedCustomerOverviewModel.ValueData();
                    location.Value = String.IsNullOrWhiteSpace(item.Location) ? "-" : _ctx.Organization.Where(data => data.SalesOfficeCode.Equals(item.Location)).FirstOrDefault().SalesOfficeDescription;
                    location.Style = "";
                    var modelRelatedCustomer = new TableRelatedCustomerOverviewModel.ValueData();
                    modelRelatedCustomer.Value = String.IsNullOrWhiteSpace(item.Model) ? "-" : item.Model;
                    modelRelatedCustomer.Style = "";
                    var countofsn = new TableRelatedCustomerOverviewModel.ValueData();
                    countofsn.Value = item.CountOfSN.ToString();
                    countofsn.Style = "";
                    var itemData = new TableRelatedCustomerOverviewModel.Data();
                    itemData.CustomerId   = custId;
                    itemData.CustomerName = custName;
                    itemData.Location     = location;
                    itemData.Model        = modelRelatedCustomer;
                    itemData.CountOfSN    = countofsn;
                    listData.Add(itemData);
                }

                var status = new TableRelatedCustomerOverviewModel.Status();
                status.Code    = 200;
                status.Message = "Sukses";

                var responseJson = new TableRelatedCustomerOverviewModel.ResponseJson();
                responseJson.Data            = listData;
                responseJson.Status          = status;
                responseJson.RecordsFiltered = getData.Item2;
                responseJson.RecordsTotal    = getData.Item3;

                Response.ContentType = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return(new EmptyResult());
            }
            else
            {
                //  string[] dataFiltered = getListSerialNumberFiltered(type, SplitArea, SplitSalesOffice, SplitCustomer, SplitFamily, SplitModel, SplitSerialNumber, RepairDateFrom, RepairDateEnd, PurchaseDateFrom, PurchaseDateEnd, DeliveryDateFrom, DeliveryDateEnd, SmuRangeFrom, SmuRangeTo, SplitProduct, SplitPlant,  Hid, Rental, Others, paramsModel, paramsSerialNumber);
                var getData  = _InventoryWeeklyBs.GetRelatedCustomerfromInventoryOverview(SplitCustomer, SplitModel, SplitSerialNumber, SplitProduct, SplitPlant, orderByDir, orderByColumn, start, length, paramsModel, paramsSerialNumber, download);
                var listData = new List <TableRelatedCustomerOverviewModel.Data>();
                foreach (var item in getData.Item1)
                {
                    var custId = new TableRelatedCustomerOverviewModel.ValueData();
                    custId.Value = item.CustomerId;
                    custId.Style = "";
                    var custName = new TableRelatedCustomerOverviewModel.ValueData();
                    custName.Value = item.CustomerName;
                    custName.Style = "";
                    var location = new TableRelatedCustomerOverviewModel.ValueData();
                    location.Value = item.Location;
                    location.Style = "";
                    var modelRelatedCustomer = new TableRelatedCustomerOverviewModel.ValueData();
                    modelRelatedCustomer.Value = item.Model;
                    modelRelatedCustomer.Style = "";
                    var countofsn = new TableRelatedCustomerOverviewModel.ValueData();
                    countofsn.Value = item.CountOfSN.ToString();
                    countofsn.Style = "";
                    var itemData = new TableRelatedCustomerOverviewModel.Data();
                    itemData.CustomerId   = custId;
                    itemData.CustomerName = custName;
                    itemData.Location     = location;
                    itemData.Model        = modelRelatedCustomer;
                    itemData.CountOfSN    = countofsn;
                    listData.Add(itemData);
                }

                var status = new TableRelatedCustomerOverviewModel.Status();
                status.Code    = 200;
                status.Message = "Sukses";

                var responseJson = new TableRelatedCustomerOverviewModel.ResponseJson();
                responseJson.Data            = listData;
                responseJson.Status          = status;
                responseJson.RecordsFiltered = getData.Item2;
                responseJson.RecordsTotal    = getData.Item3;

                Response.ContentType = "application/json";
                Response.Write(JsonConvert.SerializeObject(responseJson));
                return(new EmptyResult());
            }
        }