예제 #1
0
        public RatingVo update(RatingVo input, Guid?ratingId = null)
        {
            using (var db = new MainDb())
            {
                if (ratingId == null)
                {
                    ratingId = input.ratingId;
                }

                var res = db.ratings.FirstOrDefault(e => e.ratingId == ratingId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #2
0
        public CompanyVo update(CompanyVo input, int?companyId = null)
        {
            using (var db = new MainDb())
            {
                if (companyId == null)
                {
                    companyId = input.companyId;
                }

                var res = db.companies.Include(i => i.contactInfo).FirstOrDefault(e => e.companyId == companyId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #3
0
        public ContactInfoVo update(ContactInfoVo input, int?contactInfoId = null)
        {
            using (var db = new MainDb())
            {
                if (contactInfoId == null)
                {
                    contactInfoId = input.contactInfoId;
                }

                var res = db.contactInfos.FirstOrDefault(e => e.contactInfoId == contactInfoId);

                if (res == null)
                {
                    return(null);
                }

                if (input.state != null)
                {
                    input.state = input.state.ToUpper();
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #4
0
        public BusinessCategoryTypeVo update(BusinessCategoryTypeVo input, int?businessCategoryTypeId = null)
        {
            using (var db = new MainDb())
            {
                if (businessCategoryTypeId == null)
                {
                    businessCategoryTypeId = input.businessCategoryTypeId;
                }

                var res = db.businessCategoryTypes.FirstOrDefault(e => e.businessCategoryTypeId == businessCategoryTypeId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #5
0
        public PropertyTypeVo update(PropertyTypeVo input, int?propertyTypeId = null)
        {
            using (var db = new MainDb())
            {
                if (propertyTypeId == null)
                {
                    propertyTypeId = input.propertyTypeId;
                }

                var res = db.propertyTypes.FirstOrDefault(e => e.propertyTypeId == propertyTypeId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #6
0
        public MemberRoleLookupVo update(MemberRoleLookupVo input, Guid?memberRoleId = null)
        {
            using (var db = new MainDb())
            {
                if (memberRoleId == null)
                {
                    memberRoleId = input.memberRoleId;
                }

                var res = db.memberRoleLookups.FirstOrDefault(e => e.memberRoleId == memberRoleId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #7
0
        public MemberVo update(MemberVo input, int?memberId = null)
        {
            using (var db = new MainDb())
            {
                if (memberId == null)
                {
                    memberId = input.memberId;
                }

                var res = db.members.Include(i => i.contactInfo).FirstOrDefault(e => e.memberId == memberId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;

                if (!string.IsNullOrEmpty(input.passwordReset))
                {
                    input.password = CurrentMember.HashWord(input.passwordReset);
                }
                else
                {
                    input.password = res.password;
                }

                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #8
0
 public JsonResult Inserting(string ddxxczxx_id, string ddxxcjsj, string ddxxcjr, string ddxxremark, string ddxxjdsj, string ddxxjdr, string ddxxjd_remark,
                             string ddxxfksj, string ddxxfkr, string ddxxyxfk, string ddxxsjfk, string ddxxzd_id, string ddxxpj)
 {
     using (MainDb db = new MainDb())
     {
         zzdc_ddxx ddxx = new zzdc_ddxx();
         ddxx.czxx_id   = Convert.ToInt32(ddxxczxx_id);
         ddxx.cjsj      = Convert.ToDateTime(ddxxcjsj);
         ddxx.cjr       = ddxxcjr;
         ddxx.remark    = ddxxremark;
         ddxx.jdsj      = Convert.ToDateTime(ddxxjdsj);
         ddxx.jdr       = ddxxjdr;
         ddxx.jd_remark = ddxxjd_remark;
         ddxx.fksj      = Convert.ToDateTime(ddxxfksj);
         ddxx.fkr       = ddxxfkr;
         ddxx.yxfk      = Convert.ToInt32(ddxxyxfk);
         ddxx.sjfk      = Convert.ToInt32(ddxxsjfk);
         ddxx.zd_id     = Convert.ToInt32(ddxxzd_id);
         ddxx.pj        = ddxxpj;
         db.zzdc_ddxx.Add(ddxx);
         int count = db.SaveChanges();
         if (count > 0)
         {
             return(Json(new { result = "success" }));
         }
         else
         {
             return(Json(new { result = "fail" }));
         }
     }
 }
예제 #9
0
        public ClientOrganizationLookupVo update(ClientOrganizationLookupVo input, Guid?clientOrganizationLookupId = null)
        {
            using (var db = new MainDb())
            {
                if (clientOrganizationLookupId == null)
                {
                    clientOrganizationLookupId = input.clientOrganizationLookupId;
                }

                var res = db.clientOrganizationLookups.FirstOrDefault(e => e.clientOrganizationLookupId == clientOrganizationLookupId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
        public ActionResult Register(Customer model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            Customer c = MainDb.Customers.Where(x => x.UserName == model.UserName).FirstOrDefault();

            if (c == null)
            {
                model.CreatedDate = DateTime.Now;

                MainDb.Customers.Add(model);
                MainDb.SaveChanges();

                Session["Kullanici"]     = model.UserName;
                TemporaryUserData.UserID = model.CustomerID;

                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(View());
        }
예제 #11
0
        public ListingTypeVo update(ListingTypeVo input, int?listingTypeId = null)
        {
            using (var db = new MainDb())
            {
                if (listingTypeId == null)
                {
                    listingTypeId = input.listingTypeId;
                }

                var res = db.listingTypes.FirstOrDefault(e => e.listingTypeId == listingTypeId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #12
0
        public SurveyAnswerVo update(SurveyAnswerVo input, Guid?surveyAnswerId = null)
        {
            using (var db = new MainDb())
            {
                if (surveyAnswerId == null)
                {
                    surveyAnswerId = input.surveyAnswerId;
                }

                var res = db.surveyAnswers.FirstOrDefault(e => e.surveyAnswerId == surveyAnswerId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #13
0
        public CarVo update(CarVo input, Guid?carId = null)
        {
            using (var db = new MainDb())
            {
                if (carId == null)
                {
                    carId = input.carId;
                }

                var res = db.cars.FirstOrDefault(e => e.carId == carId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
        public JobCategoryLookupVo update(JobCategoryLookupVo input, Guid?jobCategoryLookupId = null)
        {
            using (var db = new MainDb())
            {
                if (jobCategoryLookupId == null)
                {
                    jobCategoryLookupId = input.jobCategoryLookupId;
                }

                var res = db.jobCategoryLookups.FirstOrDefault(e => e.jobCategoryLookupId == jobCategoryLookupId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
예제 #15
0
        public ActionResult CompleteOrder()
        {
            List <OrderDetail> siparisler = MainDb.OrderDetails.Where(x => x.CustomerID == TemporaryUserData.UserID && x.IsActive == true).ToList();

            foreach (var urun in siparisler)
            {
                Order o = new Order();
                o.CustomerID     = TemporaryUserData.UserID;
                o.OrderDetailsID = urun.OrderDetailsID;
                o.Discount       = Convert.ToInt32(urun.Discount);
                o.Taxes          = 18;
                o.TotalAmount    = Convert.ToInt32(urun.TotalAmount);
                o.IsCompleted    = false;
                o.OrderDate      = DateTime.Now;
                MainDb.Orders.Add(o);
                urun.IsActive = false;
            }



            MainDb.SaveChanges();

            TempData["PaymentTypes"] = MainDb.PaymentTypes.ToList();
            TempData["Customer"]     = MainDb.Customers.Where(x => x.CustomerID == TemporaryUserData.UserID).FirstOrDefault();
            ShippingViewModel model = new ShippingViewModel();

            return(View(model));
        }
예제 #16
0
        //public ContactInfoSearchFilterVm search(ContactInfoSearchFilterVm input)
        //{

        //    using (var db = new MainDb())
        //    {
        //        var query = db.contactInfos
        //                     .OrderByDescending(b => b.created)
        //                     .Where(e => (input.isActive == null || e.isActive == input.isActive)
        //                              && ((e.firstName.Contains(input.keyword) || string.IsNullOrEmpty(input.keyword))
        //                                || (e.lastName.Contains(input.keyword) || string.IsNullOrEmpty(input.keyword)))
        //                            );

        //        if (input.paging != null)
        //        {
        //            input.paging.totalCount = query.Count();
        //            query = query
        //                    .Skip(input.paging.skip)
        //                    .Take(input.paging.rowCount);

        //        }

        //        input.result = query.ToList<object>();

        //        return input;
        //    }
        //}


        public ContactInfoVm insert(ContactInfoVm input)
        {
            using (var db = new MainDb())
            {
                var company = db.companies.FirstOrDefault(c => c.companyId == input.companyId);
                db.contactInfos.Add(input.contactInfo);
                db.SaveChanges();

                if (company != null)
                {
                    company.contactInfoId = input.contactInfo.contactInfoId;
                }

                db.SaveChanges();

                return(input);
            }
        }
예제 #17
0
        public ActionResult CompleteOrder(ShippingViewModel shippingPayment)
        {
            TempData["PaymentTypes"] = MainDb.PaymentTypes.ToList();
            TempData["Customer"]     = MainDb.Customers.Where(x => x.CustomerID == TemporaryUserData.UserID).FirstOrDefault();

            if (!ModelState.IsValid)
            {
                return(View(shippingPayment));
            }

            List <Order> siparisler = MainDb.Orders.Where(x => x.CustomerID == TemporaryUserData.UserID && x.IsCompleted == false).ToList();



            shippingPayment.PaymentView.PaymentDateTime = DateTime.Now;
            MainDb.Payments.Add(shippingPayment.PaymentView);


            shippingPayment.ShippingDetailView.Email     = MainDb.Customers.Find(TemporaryUserData.UserID).Email;
            shippingPayment.ShippingDetailView.FirstName = MainDb.Customers.Find(TemporaryUserData.UserID).FirstName;
            shippingPayment.ShippingDetailView.LastName  = MainDb.Customers.Find(TemporaryUserData.UserID).LastName;
            MainDb.ShippingDetails.Add(shippingPayment.ShippingDetailView);

            TempData["message"] = "Sipraişiniz Tamamlandı!";
            MainDb.SaveChanges();
            Product p;

            foreach (var urun in siparisler)
            {
                urun.IsCompleted  = true;
                urun.ShippingID   = shippingPayment.ShippingDetailView.ShippingID;
                urun.Shipped      = true;
                urun.ShippingDate = DateTime.Now;
                urun.PaymentID    = shippingPayment.PaymentView.PaymentID;

                p = MainDb.Products.Where(x => x.ProductID == urun.OrderDetail.ProductID).FirstOrDefault();
                if (p.UnitsInStock > 0)
                {
                    if (p.UnitsInStock >= urun.OrderDetail.Quantity)
                    {
                        p.UnitsInStock = p.UnitsInStock - urun.OrderDetail.Quantity;
                    }
                    else
                    {
                        urun.OrderDetail.Quantity    = p.UnitsInStock;
                        urun.OrderDetail.TotalAmount = urun.OrderDetail.UnitPrice * urun.OrderDetail.Quantity * (1 - urun.OrderDetail.Discount);
                        p.UnitsInStock = 0;
                    }
                }
            }

            MainDb.SaveChanges();
            //TODO: bütün ürünlerden satın alınan miktar kadar UnitInStock değerinden düşme yapılacak


            return(RedirectToAction("MyOrders", "Profile"));
        }
예제 #18
0
 public JsonResult Inserting(string cpmc, int cplx, int cpdw, string cpjg, string cpms, string cpxh)
 {
     using (MainDb db = new MainDb())
     {
         HttpFileCollectionBase files = Request.Files;
         string upload   = "";
         string fileName = "";
         if (files.Count > 0)//
         {
             HttpPostedFileBase file = files[0];
             if (file.FileName != null && !"".Equals(file.FileName))//表示有文件
             {
                 try
                 {
                     string   Name      = file.FileName;
                     string[] NameArray = Name.Split(new char[] { '.' });
                     fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "." + NameArray[NameArray.Length - 1];
                     file.SaveAs(Server.MapPath("/Content/restaurant/img/upload")
                                 + "/" + fileName);
                     upload = "success";
                 }
                 catch (IOException e)
                 {
                     Console.WriteLine("IOException source: {0}", e.Source);
                     upload = "fail";
                 }
             }
         }
         zzdc_cpxx cpxx = new zzdc_cpxx();
         cpxx.name = cpmc;
         if (upload.Equals("success"))
         {
             cpxx.img = "/Content/restaurant/img/upload/" + fileName;
         }
         else
         {
             cpxx.img = "/Content/restaurant/img/miss.jpg";
         }
         cpxx.cplx_id = cplx;
         cpxx.zd_id   = cpdw;
         cpxx.price   = Convert.ToSingle(cpjg);
         cpxx.sfsj    = 0;
         cpxx.remark  = cpms;
         cpxx.rank    = Convert.ToInt32(cpxh);
         db.zzdc_cpxx.Add(cpxx);
         int count = db.SaveChanges();
         if (count > 0)
         {
             return(Json(new { result = "success", upload = upload }));
         }
         else
         {
             return(Json(new { result = "fail", upload = upload }));
         }
     }
 }
예제 #19
0
        public CarVo insert(CarVo input)
        {
            using (var db = new MainDb())
            {
                db.cars.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #20
0
        public SurveyAnswerVo insert(SurveyAnswerVo input)
        {
            using (var db = new MainDb())
            {
                db.surveyAnswers.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #21
0
        public ListingTypeVo insert(ListingTypeVo input)
        {
            using (var db = new MainDb())
            {
                db.listingTypes.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #22
0
        public ImageVo insert(ImageVo input)
        {
            using (var db = new MainDb())
            {
                db.images.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #23
0
        public ClientOrganizationLookupVo insert(ClientOrganizationLookupVo input)
        {
            using (var db = new MainDb())
            {
                db.clientOrganizationLookups.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #24
0
        public MemberRoleLookupVo insert(MemberRoleLookupVo input)
        {
            using (var db = new MainDb())
            {
                db.memberRoleLookups.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #25
0
        public ClientVo insert(ClientVo input)
        {
            using (var db = new MainDb())
            {
                db.clients.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
        public ListingCategoryLookupVo insert(ListingCategoryLookupVo input)
        {
            using (var db = new MainDb())
            {
                db.listingCategoryLookups.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #27
0
        public BusinessCategoryTypeVo insert(BusinessCategoryTypeVo input)
        {
            using (var db = new MainDb())
            {
                db.businessCategoryTypes.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #28
0
        public CompanyCategoryLookupVo insert(CompanyCategoryLookupVo input)
        {
            using (var db = new MainDb())
            {
                db.companyCategoryLookups.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #29
0
        public PropertyTypeVo insert(PropertyTypeVo input)
        {
            using (var db = new MainDb())
            {
                db.propertyTypes.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
예제 #30
0
        public RatingVo insert(RatingVo input)
        {
            using (var db = new MainDb())
            {
                db.ratings.Add(input);
                db.SaveChanges();

                return(input);
            }
        }