示例#1
0
 public int Update(tblResumeData resumeData)
 {
     try
     {
         using (var dbContext = new PMSEntities())
         {
             dbContext.tblResumeDatas.Attach(resumeData);
             dbContext.Entry(resumeData).State = EntityState.Modified;
             foreach (var obj in resumeData.tblEducations)
             {
                 if (obj.Id != 0)
                 {
                     dbContext.tblEducations.Attach(obj);
                     dbContext.Entry(obj).State = EntityState.Modified;
                 }
                 else
                 {
                     obj.ResumeId    = resumeData.ResumeId;
                     obj.EducationId = Guid.NewGuid();
                     dbContext.tblEducations.Add(obj);
                 }
             }
             dbContext.SaveChanges();
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#2
0
 public ActionResult Edit(Purchase purchase)
 {
     if (ModelState.IsValid)
     {
         try
         {
             db.Purchases.Attach(purchase);
             db.Entry(purchase).Property(r => r.IsPaid).IsModified      = true;
             db.Entry(purchase).Property(r => r.Description).IsModified = true;
             //db.Entry(purchase).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (DbEntityValidationException dbEx)
         {
             foreach (var validationErrors in dbEx.EntityValidationErrors)
             {
                 foreach (var validationError in validationErrors.ValidationErrors)
                 {
                     Trace.TraceInformation("Property: {0} Error: {1}",
                                            validationError.PropertyName,
                                            validationError.ErrorMessage);
                 }
             }
         }
     }
     ViewBag.Supplier_ID = new SelectList(db.Suppliers, "ID", "Supplier_Name", purchase.Supplier_ID);
     return(View(purchase));
 }
示例#3
0
        public ActionResult EditRoleMemberWS(WS_User_Roles model, List <string> chk1)
        {
            WS_User_Roles wsp = db.WS_User_Roles.Find(model.ID);

            wsp.Role_Admin   = model.Role_Admin;
            wsp.Role_Manager = model.Role_Manager;
            wsp.Role_Member  = model.Role_Member;

            db.Entry(wsp).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("AddMemberWS", new { id = wsp.WorkSpace_ID }));
        }
示例#4
0
        public ActionResult Edit([Bind(Include = "DrId,DrName,DrPassword,Specialzaition,DrEmail,DrContactNumber,DrExperience,DrGender,IsActive,Cretedby,Modifiedby,Creteddate,Modifieddate")] DoctorManage doctorManage)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var ModifiedName = Convert.ToString(Session["AdminName"]);
                    doctorManage.Modifiedby = ModifiedName;

                    if (Session["DrId"] == null)
                    {
                        doctorManage.IsActive = false;
                    }
                    else if (Session["DrId"] != null)
                    {
                        doctorManage.IsActive = true;
                    }
                    doctorManage.Modifieddate    = DateTime.Now;
                    db.Entry(doctorManage).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["msg"] = "Doctor Details Updated!!";

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    TempData["err"] = ex.Message;
                }
            }
            return(View(doctorManage));
        }
示例#5
0
        public IHttpActionResult PutExaminationType(Guid id, ExaminationType examinationType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != examinationType.ExaminationTypeId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult Edit([Bind(Include = "StaffId,StaffName,StaffPassword,StaffEmail,StaffContactNumber,StaffDesignation,StaffExperience,IsActive,Cretedby,Modifiedby,Creteddate,Modifieddate")] StaffManage staffManage)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var ModifiedName = Convert.ToString(Session["AdminName"]);
                    staffManage.Modifiedby   = ModifiedName;
                    staffManage.Modifieddate = DateTime.Now;
                    if (Session["SId"] == null)
                    {
                        staffManage.IsActive = false;
                    }
                    else if (Session["SId"] != null)
                    {
                        staffManage.IsActive = true;
                    }

                    db.Entry(staffManage).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["msg"] = "Staff Details Updated!!";
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    TempData["err"] = ex.Message;
                }
            }
            return(View(staffManage));
        }
示例#7
0
        public ActionResult Edit([Bind(Include = "Pid,Pname,Address1,Address2,Gender,DOB,PContactNumber,PEmail,Cretedby,Modifiedby,Creteddate,Modifieddate,RefCityid")] PatientManage patientManage)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var ModifiedName = Convert.ToString(Session["AdminName"]);
                    patientManage.Modifiedby      = ModifiedName;
                    patientManage.Modifieddate    = DateTime.Now;
                    db.Entry(patientManage).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["msg"] = "Patient Details Updated!!";

                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    TempData["err"] = ex.Message;
                }
            }
            ViewBag.CountryId = new SelectList(db.CountryMasters.ToList(), "CountryId", "CountryName");
            ViewBag.StateId   = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "", Value = "Select State"
                }
            };
            ViewBag.RefCityid = new SelectList(db.CityMasters, "CityId", "CityName", patientManage.RefCityid);
            return(View(patientManage));
        }
示例#8
0
        public async Task <ActionResult> Edit(newProjectModels model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(model).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                if (ex is DbEntityValidationException)
                {
                    foreach (var validationErrors in ((DbEntityValidationException)ex).EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                        }
                    }
                    //return InternalServerError();
                }
            }
            ViewBag.ApplicationsId    = new SelectList(db.Applications, "Id", "Name", model.ApplicationsId);
            ViewBag.ArchitectId       = new SelectList(db.Architects, "Id", "FullName", model.ArchitectId);
            ViewBag.BusinessPartnerId = new SelectList(db.BusinessPartners, "Id", "FullName", model.BusinessPartnerId);
            ViewBag.FixingTypeId      = new SelectList(db.FixingTypes, "Id", "Name", model.FixingTypeId);
            ViewBag.OwnerId           = new SelectList(db.Owners, "Id", "FullName", model.OwnerId);
            ViewBag.ProjectTypeId     = new SelectList(db.ProjectTypes, "Id", "Name", model.ProjectTypeId);
            return(View(model));
        }
示例#9
0
 public void Update(Vehicle_Parking obj)
 {
     using (PMSEntities db = new PMSEntities())
     {
         db.Vehicle_Parking.Attach(obj);
         db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
 public ActionResult Edit(Drug_Generic_name drug_generic_name)
 {
     if (ModelState.IsValid)
     {
         db.Entry(drug_generic_name).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(drug_generic_name));
 }
示例#11
0
        /// <summary>
        /// Thay đổi role của một user
        /// </summary>
        /// <param name="model">Participate model</param>
        public void editRoleUser(Participate model)
        {
            Participate user = findMemberInGroup(model.Id);

            user.IsAdmin         = model.IsAdmin;
            user.IsManager       = model.IsManager;
            user.Updated_At      = DateTime.Now;
            db.Entry(user).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
 public ActionResult Edit(Medicine_Information medicine_information)
 {
     if (ModelState.IsValid)
     {
         db.Medicine_Information.Attach(medicine_information);
         db.Entry(medicine_information).Property(r => r.Medicine_Name).IsModified   = true;
         db.Entry(medicine_information).Property(r => r.Category).IsModified        = true;
         db.Entry(medicine_information).Property(r => r.Manufacturer_ID).IsModified = true;
         // db.Entry(medicine_information).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(medicine_information));
     }
     //ViewBag.Generic_ID = new SelectList(db.Drug_Generic_name, "ID", "Genric_Name", medicine_information.Generic_ID);
     // ViewBag.Manufacturer_ID = new SelectList(db.Manufacturers, "ID", "Manufacturer_Name", medicine_information.Manufacturer_ID);
 }
示例#13
0
 public ActionResult Edit(Supplier supplier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supplier));
 }
 public ActionResult Edit(Sale sale)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sale).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Bill_Invoice = new SelectList(db.Bill_Information, "Invoice_No", "Discount", sale.Bill_Invoice);
     ViewBag.Medicine_ID  = new SelectList(db.Medicine_Information, "ID", "Medicine_Name", sale.Medicine_ID);
     return(View(sale));
 }
 public ActionResult Edit(Batch batch)
 {
     if (ModelState.IsValid)
     {
         db.Batches.Attach(batch);
         db.Entry(batch).Property(r => r.Sell_Price).IsModified = true;
         //db.Entry(batch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Medicine_ID = new SelectList(db.Medicine_Information, "ID", "Medicine_Name", batch.Medicine_ID);
     ViewBag.Purchase_ID = new SelectList(db.Purchases, "Purchase_ID", "Discount", batch.Purchase_ID);
     return(View(batch));
 }
 public ActionResult AEdit([Bind(Include = "RefPid,RefDid,AppointmentStartDate,AppointmentEndDate,Purpose,Status,DocumentUpload,Cretedby,Modifiedby,Creteddate,Modifieddate,Aid")] AppointmentManage appointmentManage)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var ModifiedName = Convert.ToString(Session["AdminName"]);
             appointmentManage.Modifiedby      = ModifiedName;
             appointmentManage.Modifieddate    = DateTime.Now;
             db.Entry(appointmentManage).State = EntityState.Modified;
             db.SaveChanges();
             TempData["msg"] = "Appointment Updated!!";
             return(RedirectToAction("AIndex"));
         }
         catch (Exception ex)
         {
             TempData["err"] = ex.Message;
         }
     }
     ViewBag.RefDid = new SelectList(db.DoctorManages, "DrId", "DrName", appointmentManage.RefDid);
     ViewBag.RefPid = new SelectList(db.PatientManages, "Pid", "Pname", appointmentManage.RefPid);
     return(View(appointmentManage));
 }
示例#17
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,VisitedBy,VisitedOn,ActionPlanReportUrl,NewProjectId,ProjectStatusId,ProjectHealthId")] VisitReport visitReport)
        {
            if (ModelState.IsValid)
            {
                db.Entry(visitReport).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.NewProjectId    = new SelectList(db.NewProjects, "Id", "ProjectName", visitReport.NewProjectId);
            ViewBag.ProjectHealthId = new SelectList(db.ProjectHealths, "Id", "Name", visitReport.ProjectHealthId);
            ViewBag.ProjectStatusId = new SelectList(db.ProjectStatus, "Id", "Name", visitReport.ProjectStatusId);
            return(View(visitReport));
        }
        public JsonResult SaveAndUpdateProduct(int PID, string Name, string Description, float Price)
        {
            var result = new jsonMessage();

            try
            {
                //define the model
                Mst_Product _Mst_Product = new Mst_Product();
                _Mst_Product.PID         = PID;
                _Mst_Product.Name        = Name;
                _Mst_Product.Description = Description;
                _Mst_Product.Price       = Price;


                //for insert recored..
                if (_Mst_Product.PID == 0)
                {
                    context.Mst_Product.Add(_Mst_Product);
                    result.Message = "your product has been saved success..";
                    result.Status  = true;
                }
                else  //for update recored..
                {
                    context.Entry(_Mst_Product).State = EntityState.Modified;
                    result.Message = "your product has been updated successfully..";
                    result.Status  = true;
                }
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                ErrorLogers.ErrorLog(ex);
                result.Message = "We are unable to process your request at this time. Please try again later.";
                result.Status  = false;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#19
0
 public int Update(tblVendorData data)
 {
     try
     {
         using (var dbContext = new PMSEntities())
         {
             dbContext.tblVendorDatas.Attach(data);
             dbContext.Entry(data).State = EntityState.Modified;
             dbContext.SaveChanges();
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#20
0
 public int UpdateOutward(tblOutwardWO outWardData)
 {
     try
     {
         using (var dbContext = new PMSEntities())
         {
             dbContext.tblOutwardWOes.Attach(outWardData);
             dbContext.Entry(outWardData).State = EntityState.Modified;
             dbContext.SaveChanges();
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#21
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,ProjectName,City,Street,CommencedOn,ConcludedOn,ArchitectId,BusinessPartnerId,PlanUrl,SectionsUrl,ElevationsUrl,TDImageUrl,AreaPanelCalculationUrl,ConceptsDrawingUrl,OptimizationUrl,ShopDrawingUrl,AnalysisUrl,BOQUrl,InteriorUrl,OwnerId,ProjectTypeId,FixingTypeId,ApplicationsId,TDRenderImageUrl")] NewProject newProject)
        {
            if (ModelState.IsValid)
            {
                db.Entry(newProject).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.ApplicationsId    = new SelectList(db.Applications, "Id", "Name", newProject.ApplicationsId);
            ViewBag.ArchitectId       = new SelectList(db.Architects, "Id", "FullName", newProject.ArchitectId);
            ViewBag.BusinessPartnerId = new SelectList(db.BusinessPartners, "Id", "FullName", newProject.BusinessPartnerId);
            ViewBag.FixingTypeId      = new SelectList(db.FixingTypes, "Id", "Name", newProject.FixingTypeId);
            ViewBag.OwnerId           = new SelectList(db.Owners, "Id", "FullName", newProject.OwnerId);
            ViewBag.ProjectTypeId     = new SelectList(db.ProjectTypes, "Id", "Name", newProject.ProjectTypeId);
            return(View(newProject));
        }
 public int Update(tblCorrespondence correspondenceData)
 {
     try
     {
         using (var dbContext = new PMSEntities())
         {
             dbContext.tblCorrespondences.Attach(correspondenceData);
             dbContext.Entry(correspondenceData).State = EntityState.Modified;
             dbContext.SaveChanges();
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#23
0
        static void PerformScheduledTasks(string key, Object value, CacheItemRemovedReason reason)
        {
            try
            {
                PMSEntities context = new PMSEntities();

                SerialPort Stream = new SerialPort("COM15", 9600);
                Stream.Close();
                Stream.Open();


                string parkID    = Stream.ReadLine();
                string parkIDNew = parkID.Remove(parkID.Length - 1);
                System.Threading.Thread.Sleep(1000);
                string value1   = Stream.ReadLine();
                string valueNew = value1.Remove(value1.Length - 1);

                parking objParking = context.parkings.Where(o => o.parking_id == parkIDNew).FirstOrDefault();
                if (valueNew == "in")
                {
                    objParking.parking_available_slots = objParking.parking_available_slots - 1;
                }
                else
                {
                    objParking.parking_available_slots = objParking.parking_available_slots + 1;
                }
                context.Entry(objParking).State = EntityState.Modified;
                context.SaveChanges();

                //GetCount();
                Stream.Close();

                ScheduleTaskTrigger();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#24
0
 public void Delete(T model)
 {
     dataContext.Entry(model).State = EntityState.Modified;
     dataContext.SaveChanges();
 }
示例#25
0
        public HttpResponseMessage UpdateProduct(int id)
        {
            Product             product = new Product();
            HttpResponseMessage result  = null;
            var httpRequest             = HttpContext.Current.Request;

            product.PID      = id;
            product.PName    = httpRequest["PName"];
            product.Discount = Convert.ToInt32(httpRequest["Discount"]);
            product.Price    = Convert.ToInt32(httpRequest["Price"]);
            product.Quantity = Convert.ToInt32(httpRequest["Quantity"]);

            if (httpRequest["IsStock"] == "true")
            {
                product.IsStock = true;
            }
            else
            {
                product.IsStock = false;
            }

            if (httpRequest.Files.Count > 0)
            {
                //var docfiles = new List<string>();
                foreach (string file in httpRequest.Files)
                {
                    var allowedExtensions = new[] {
                        ".jpg", ".png", ".jpg", "jpeg"
                    };

                    var postedFile = httpRequest.Files[file];

                    var fileName = Path.GetFileName(postedFile.FileName);  //getting only file name(ex-ganesh.jpg)
                    var ext      = Path.GetExtension(postedFile.FileName); //getting the extension(ex-.jpg)
                    if (allowedExtensions.Contains(ext.ToLower()))         //check what type of extension
                    {
                        Stream       stream       = postedFile.InputStream;
                        BinaryReader binaryReader = new BinaryReader(stream);
                        Byte[]       bytes        = binaryReader.ReadBytes((int)stream.Length);

                        product.ImageName = fileName;
                        product.ImageCode = bytes;

                        db.Entry(product).State = EntityState.Modified;
                        try
                        {
                            db.SaveChanges();
                        }
                        catch (DbUpdateConcurrencyException)
                        {
                            if (!ProductExists(id))
                            {
                                return(Request.CreateResponse(HttpStatusCode.BadRequest));
                            }
                            else
                            {
                                throw;
                            }
                        }
                    }
                }
                result = Request.CreateResponse(HttpStatusCode.NoContent);
            }
            else
            {
                result = Request.CreateResponse(HttpStatusCode.BadRequest);
            }
            return(result);
        }
示例#26
0
 public void Edit(HMS_Control control)
 {
     dbContext.Entry(control).State = EntityState.Modified;
     dbContext.SaveChanges();
 }