コード例 #1
0
        public IHttpActionResult PutAdmin(int id, Admin admin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != admin.AdminID)
            {
                return(BadRequest());
            }

            db.Entry(admin).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AdminExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public JsonResult companyDeactivate(company company)
        {
            var selected = db.company.Where(x => x.companyId == company.companyId).FirstOrDefault();

            selected.isCompanyActive = "0";
            db.SaveChanges();
            return(Json(JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public JsonResult postDeactivate(job_post post)
        {
            var selected = db.job_post.Where(x => x.jobPostId == post.jobPostId).FirstOrDefault();

            selected.isActivePost = "0";
            db.SaveChanges();
            return(Json(JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create([Bind(Include = "RCID,inwordno,consumer_no,consumer_name,pervious_outstanding,after_rebate_outstanding,difference,difference_percentage,cancledby,cancledon")] Rebate_cancle_history rebate_cancle_history)
        {
            if (ModelState.IsValid)
            {
                db.Rebate_cancle_history.Add(rebate_cancle_history);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rebate_cancle_history));
        }
        public ActionResult Create([Bind(Include = "sno,consumer_no,consumer_code,consumer_name,consumer_address,category,area,issue_date,due_date,billing_month,part_payment_into,current_Charges,outstanding_Arrears,part_payemnt_arrears,createdby,createdon,status,barcode")] partPayment partPayment)
        {
            if (ModelState.IsValid)
            {
                db.partPayments.Add(partPayment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(partPayment));
        }
コード例 #6
0
 public ActionResult Add(business_stream bs)
 {
     if (bs.businessName != null)
     {
         var newbs = new business_stream();
         newbs.businessName = bs.businessName;
         db.business_stream.Add(newbs);
         db.SaveChanges();
     }
     return(RedirectToAction("Index", "BusinessArea"));
 }
        public ActionResult Create([Bind(Include = "SearchID,inword,consumer_no,zone,Createdby,createdon")] searchingsheet searchingsheet)
        {
            if (ModelState.IsValid)
            {
                db.searchingsheets.Add(searchingsheet);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(searchingsheet));
        }
コード例 #8
0
        public ActionResult Create([Bind(Include = "MUCTBillID,ConsumerNo,Zone,Town,Employee,Createdon,createdby")] MUCTBill_Records mUCTBill_Records)
        {
            if (ModelState.IsValid)
            {
                db.MUCTBill_Records.Add(mUCTBill_Records);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mUCTBill_Records));
        }
        public ActionResult Create([Bind(Include = "sno,inword,modification_status,consumer_no,previous_category,previous_area,previous_Storey,previous_current_Charges,previous_outstanding_Arrears,new_category,new_area,new_storey,new_current_Charge,new_outstanding_Arrears,zone,town,billing_month,consumer_surcharge,createdby,createdon,description,status")] modify_invoice modify_invoice)
        {
            if (ModelState.IsValid)
            {
                db.modify_invoice.Add(modify_invoice);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(modify_invoice));
        }
        public ActionResult Create([Bind(Include = "muctempid,employee,designation")] muctemployee muctemployee)
        {
            if (ModelState.IsValid)
            {
                db.muctemployees.Add(muctemployee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(muctemployee));
        }
        public ActionResult Create([Bind(Include = "impactID,inword,modification_status,consumer_no,consumer_name,previous_arrears,after_correction,difference,difference_percentage,impact,Description,createdon,createdby,status")] modify_impact modify_impact)
        {
            if (ModelState.IsValid)
            {
                db.modify_impact.Add(modify_impact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(modify_impact));
        }
コード例 #12
0
        public ActionResult Create([Bind(Include = "propertyTypeID,propertyTypeName,PropertyCode,SizeIn")] propertytype propertytype)
        {
            if (ModelState.IsValid)
            {
                db.propertytypes.Add(propertytype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(propertytype));
        }
        public ActionResult Create([Bind(Include = "modify_consumerID,inword_no,modification_status,consumer_no,previous_name,previous_surname,previous_cnic,previous_mobile,previous_address,new_name,new_surname,new_cnic,new_mobile,new_address,createdby,createdon,description,approvedby,status")] modify_consumer modify_consumer)
        {
            if (ModelState.IsValid)
            {
                db.modify_consumer.Add(modify_consumer);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(modify_consumer);
        }
        public ActionResult Create([Bind(Include = "sno,inword,consumer_no,emp_id,consumer_name,consumer_fname,consumer_cnic,consumer_mobile,consumer_address,category,area,outstanding_Arrears,after_rebate,description,createdby,createdon,status")] kmc_emp_rebate kmc_emp_rebate)
        {
            if (ModelState.IsValid)
            {
                db.kmc_emp_rebate.Add(kmc_emp_rebate);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(kmc_emp_rebate));
        }
コード例 #15
0
        public ActionResult Create([Bind(Include = "sno,consumer_no,consumer_code,consumer_name,consumer_address,category,area,sqft_sqyd,Storey,zone,town,uc_no,uc_name,block,issue_date,due_date,billing_month,current_Charges,outstanding_Arrears,current_arrears,consumer_service_charges,within_duedate_amount,consumer_surcharge,after_duedate_amount,property_tag,kmc_category,createdby,createdon,status,consumer_checkdigit,billing_period_code,barcode,checkdigit_status,part_payment_createdon,part_payment_createdby,part_payment_arrears,part_payment_into,rebate_status,short_description,Department_Arrears,Arrears_15")] invoice invoice)
        {
            if (ModelState.IsValid)
            {
                db.invoices.Add(invoice);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(invoice));
        }
        public ActionResult Create([Bind(Include = "SubCategoryID,SubCategoryName,subcategorycode,PropertyTypeID,Status")] subcategoryproperty subcategoryproperty)
        {
            if (ModelState.IsValid)
            {
                db.subcategoryproperties.Add(subcategoryproperty);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(subcategoryproperty));
        }
        public ActionResult Create([Bind(Include = "SSID,InwordNo,Consumer_No,Department,Zone,Twon,Createdon,Createdby")] searchinsheetsuspended searchinsheetsuspended)
        {
            if (ModelState.IsValid)
            {
                db.searchinsheetsuspendeds.Add(searchinsheetsuspended);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(searchinsheetsuspended));
        }
コード例 #18
0
        public JsonResult userDeactivate(user_account user)
        {
            var selectedUser = db.user_account.Where(x => x.userAccountId == user.userAccountId).FirstOrDefault();

            selectedUser.userIsActive = "0";
            db.SaveChanges();
            return(Json(JsonRequestBehavior.AllowGet));
        }
コード例 #19
0
        public ActionResult Create([Bind(Include = "ZoneID,ZoneName,Status")] zone zone)
        {
            if (ModelState.IsValid)
            {
                zone.Status = 1;
                db.zones.Add(zone);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(zone));
        }
コード例 #20
0
        public ActionResult Login(user_account user)
        {
            var us       = user.userEmail;
            var ps       = user.userPassword;
            var password = Crypt.Encrypt(user.userPassword);
            var data     = db.user_admin.Where(x => x.adminEmail == user.userEmail && x.adminPassword == password && x.adminIsActive == "1").FirstOrDefault();

            if (data != null)
            {
                LoginStatus.Current.IsLogin  = true;
                LoginStatus.Current.Name     = data.adminName;
                LoginStatus.Current.Surname  = data.adminSurname;
                LoginStatus.Current.UserId   = data.adminAccountId;
                LoginStatus.Current.IsActive = data.adminIsActive;
                var userLog = db.admin_log.Where(x => x.adminAccountID == data.adminAccountId).FirstOrDefault();
                if (userLog == null)
                {
                    admin_log log = new admin_log();
                    log.adminAccountID = data.adminAccountId;
                    log.loginDate      = DateTime.Now;
                    string ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                    if (ipAddress == "" || ipAddress == null)
                    {
                        ipAddress = Request.ServerVariables["REMOTE_ADDR"];
                    }
                    log.loginIp = ipAddress;
                    db.admin_log.Add(log);
                    db.SaveChanges();
                }
                else
                {
                    userLog.loginDate = DateTime.Now;
                    string ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                    if (ipAddress == "" || ipAddress == null)
                    {
                        ipAddress = Request.ServerVariables["REMOTE_ADDR"];
                    }
                    userLog.loginIp = ipAddress;
                    db.SaveChanges();
                }

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Warning = "Kullanıcı adı ve ya şifre hatalı.";
            }
            return(View());
        }
コード例 #21
0
        public JsonResult SaveUrlaub(Events e)
        {
            var status = false;

            using (AdminEntities dc = new AdminEntities())
            {
                if (e.EventID > 0)
                {
                    ///Update Urlaub
                    var v = dc.Events.Where(a => a.EventID == e.EventID).FirstOrDefault();
                    if (v != null)
                    {
                        v.Subject     = e.Subject;
                        v.Start       = e.Start;
                        v.End         = e.End;
                        v.Description = e.Description;
                        v.ThemeColor  = e.ThemeColor;
                    }
                }
                else
                {
                    dc.Events.Add(e);
                }

                dc.SaveChanges();
                status = true;
            }

            return(new JsonResult {
                Data = new { status = status }
            });
        }
コード例 #22
0
        public ActionResult Edit(business_departments bd)
        {
            var selectedBd = db.business_departments.FirstOrDefault(x => x.businessDepId == bd.businessDepId);

            if (selectedBd != null)
            {
                selectedBd.businessDepName = bd.businessDepName;
                db.SaveChanges();
                return(RedirectToAction("Index", "BusinessDepartment"));
            }
            else
            {
                ViewBag.Warning = "Düzenleme gerçekleştirilemedi.";
                return(View());
            }
        }
コード例 #23
0
        public ActionResult Edit(countries country)
        {
            var bs = db.countries.FirstOrDefault(x => x.countryId == country.countryId);

            if (bs != null)
            {
                bs.countryName = country.countryName;
                db.SaveChanges();
                return(RedirectToAction("Index", "Country"));
            }
            else
            {
                ViewBag.Warning = "Düzenleme gerçekleştirilemedi.";
                return(View());
            }
        }
コード例 #24
0
        public ActionResult Edit(departments department)
        {
            var dep = db.departments.FirstOrDefault(x => x.departmentsId == department.departmentsId);

            if (dep != null)
            {
                dep.departmentName = department.departmentName;
                db.SaveChanges();
                return(RedirectToAction("Index", "Department"));
            }
            else
            {
                ViewBag.Warning = "Düzenleme gerçekleştirilemedi.";
                return(View());
            }
        }
コード例 #25
0
        public ActionResult Edit(universities uni)
        {
            var selectedUni = db.universities.FirstOrDefault(x => x.universityId == uni.universityId);

            if (selectedUni != null)
            {
                selectedUni.universityName = uni.universityName;
                db.SaveChanges();
                return(RedirectToAction("Index", "University"));
            }
            else
            {
                ViewBag.Warning = "Düzenleme gerçekleştirilemedi.";
                return(View());
            }
        }
コード例 #26
0
        public ActionResult DeleteConfirmed(int id)
        {
            town town = db.towns.Find(id);

            db.towns.Remove(town);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #27
0
 public bool InsertAdmin(Admin ad)
 {
     using (AdminEntities db = new AdminEntities())
     {
         db.Admins.Add(ad);
         int row = db.SaveChanges();
         return(row > 0);
     }
 }
コード例 #28
0
        public ActionResult Create([Bind(Include = "userinfoID,Username,FullName,Password,Mobile,Email,CNIC,Address,RoleID,AccountStatusID")] userinfo userinfo)
        {
            if (!ModelState.IsValid)
            {
                db.userinfoes.Add(userinfo);
                //db.Entry(userinfo).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else if (ModelState.IsValid)
            {
                db.userinfoes.Add(userinfo);
                db.Entry(userinfo).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(userinfo));
        }
コード例 #29
0
 public bool DeleteAdmin(Admin ad)
 {
     using (AdminEntities db = new AdminEntities())
     {
         db.Admins.Attach(ad);
         db.Admins.Remove(ad);
         int a = db.SaveChanges();
         return(a > 0);
     }
 }
コード例 #30
0
 public bool UpdateAdmin(Admin ad)
 {
     using (AdminEntities db = new AdminEntities())
     {
         db.Admins.Attach(ad);
         db.Entry(ad).State = System.Data.Entity.EntityState.Modified;
         int row = db.SaveChanges();
         return(row > 0);
     }
 }