コード例 #1
0
        public ActionResult UpdateMeasurementUnit(MeasurementUnits UNitDetails)
        {
            try
            {
                MeasurementUnits measurement = new MeasurementUnits();
                measurement                 = db.MeasurementUnits.Find(UNitDetails.MeasurementUnitID);
                measurement.UpdateBy        = AppUtils.GetLoginUserID();
                measurement.UpdateDate      = AppUtils.GetDateTimeNow();
                measurement.UnitName        = UNitDetails.UnitName;
                db.Entry(measurement).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                var measurementUnit =
                    new CustomMeasuremetUnit()
                {
                    MeasurementUnitID     = UNitDetails.MeasurementUnitID,
                    UnitName              = UNitDetails.UnitName,
                    UpdateMeasurementUnit = ISP_ManagementSystemModel.AppUtils.HasAccessInTheList(ISP_ManagementSystemModel.AppUtils.Update_Attendance_Type) ? true : false,
                };
                var JSON = Json(new { UpdateSuccess = true, Units = measurementUnit }, JsonRequestBehavior.AllowGet);
                JSON.MaxJsonLength = int.MaxValue;
                return(JSON);
            }
            catch (Exception ex)
            {
                return(Json(new { UpdateSuccess = false, EMPLH = "" }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public JsonResult InsertMeasurementUnit(MeasurementUnits measureUnit)
        {
            try
            {
                db.MeasurementUnits.Add(measureUnit);
                measureUnit.CreateBy   = AppUtils.GetLoginUserID();
                measureUnit.CreateDate = AppUtils.GetDateTimeNow();
                measureUnit.Status     = AppUtils.TableStatusIsActive;
                db.SaveChanges();
                CustomMeasuremetUnit UnitInfo = new CustomMeasuremetUnit
                {
                    MeasurementUnitID     = measureUnit.MeasurementUnitID,
                    UnitName              = measureUnit.UnitName,
                    UpdateMeasurementUnit = ISP_ManagementSystemModel.AppUtils.HasAccessInTheList(ISP_ManagementSystemModel.AppUtils.Update_Measurement_Unit) ? true : false,
                };


                return(Json(new { SuccessInsert = true, UnitInfo = UnitInfo }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet));
            }
        }