Ejemplo n.º 1
0
        public JsonResult GenerateDetailListView(string DetailStr)
        {
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            List <Sell.LendingCars.LendingCarsDetailViewSModel>  List       = serializer.Deserialize <List <Sell.LendingCars.LendingCarsDetailViewSModel> >(DetailStr);

            foreach (var aa in List)
            {
                if (aa.IsDelete)
                {
                    if (aa.IDDetailReqAmani != 0)
                    {
                        Sell.LendingCars.LendingCarsDetail LendingCarsRepo = new Sell.LendingCars.LendingCarsDetail();
                        LendingCarsRepo.DeleteByMaster(aa.IDDetailReqAmani);
                    }
                }
            }
            List = List.Where(p => p.IsDelete == false).ToList();
            foreach (var a in List)
            {
                //        "data": "radif",
                //        "title": "ردیف",
                //"data": "CarName",
                //"title": "خودرو",
                // "data": "num",
                // "title": "تعداد",
                //                "data": "Days",
                //                "title": "مدت",
                //"data": "typeDliv",
                //"title": "نوع تحویل گیرنده",
                //  "data": "nameDliv",
                //  "title": "تحویل گیرنده",
                //  "data": "StatusDesc",
                //  "title": "وضعیت",
                //  "data": "pt_desc",
                //  "title": " کاربری",
                Sell.Products.Products product = new Sell.Products.Products();
                var model = product.GetProductType().Where(p => p.Id == a.F_IDCar);
                a.CarName = model.FirstOrDefault().Name;
                if (a.DelivType == 1)
                {
                    a.typeDliv = "نمایندگی";
                    a.nameDliv = new Sell.Agents.Agents().GetByID(Convert.ToInt32(a.F_Deliver)).Agent_AGNDesc;
                }
                var Usage = product.GetProductUsageByProductTypeId(Convert.ToInt32(a.F_IDCar));
                a.pt_desc    = Usage.Where(p => p.F_pyprmtflID == a.F_UsageType).FirstOrDefault().pt_desc;
                a.StatusDesc = "آماده تایید امانی";
            }
            return(Json(List, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public JsonResult ContractDetailFillCombosNotSaved(string DetailItem)
        {
            DataLayer.AtsTotalNewDataContext context = new DataLayer.AtsTotalNewDataContext();
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var model        = serializer.Deserialize <Sell.LendingCars.LendingCarsDetailViewSModel>(DetailItem);
            var ProductUsage = new Sell.Products.Products().GetProductUsageByProductTypeId((int)model.F_IDCar).Where(p => p.F_pyprmtflID == model.F_UsageType).FirstOrDefault();
            var ProductType  = context.T00050016s.Where(p => p.CarId == (int)model.F_IDCar).FirstOrDefault();
            var Delivery     = new Sell.Agents.Agents().GetByID((int)model.F_Deliver);
            var ProductGroup = context.T00020002s.Where(p => p.pyprmtflID == ProductType.CarGroup).FirstOrDefault();

            return(Json(new
            {
                ProductGroup = ProductGroup.pt_desc,
                ProductType = ProductType.CarName,
                ProductUsage = (ProductUsage == null) ? "انتخاب کنید" : ProductUsage.pt_desc,
                DeliveryAddress = Delivery.Agent_AGNDesc,
                ProductGroupId = ProductType.CarGroup,
                ProductTypeId = ProductType.CarId,
                ProductUsageId = (ProductUsage == null) ? 0 : model.F_UsageType,
                DeliveryAddressId = model.F_Deliver,
            }, JsonRequestBehavior.AllowGet));
        }