示例#1
0
        public JsonResult AjaxTypeDelete(string row)
        {
            TPO.Web.Core.ResponseMessage responseMessage;

            try
            {
                ScrimTypeModel scrimType = JsonConvert.DeserializeObject <ScrimTypeModel>(row);
                if (scrimType != null)
                {
                    ScrimTypeDto dto = new ScrimTypeDto();
                    using (ScrimTypeService service = new ScrimTypeService())
                    {
                        Mapper.Map(scrimType, dto);
                        if (scrimType.ID > 0)
                        {
                            service.Delete(dto.ID);
                        }
                    }
                }

                responseMessage = SetResponseMesssage(ActionTypeMessage.SuccessfulSave);
            }
            catch (Exception exc)
            {
                responseMessage = SetResponseMesssage(ActionTypeMessage.FailedSave, exc.Message);
            }

            return(Json(responseMessage, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult AjaxTypeUpdate(string row)
        {
            TPO.Web.Core.ResponseMessage responseMessage;

            try
            {
                ScrimTypeModel scrimType = JsonConvert.DeserializeObject <ScrimTypeModel>(row);
                if (scrimType != null)
                {
                    scrimType.LastModified = DateTime.Now;
                    ScrimTypeDto dto = new ScrimTypeDto();
                    using (ScrimTypeService service = new ScrimTypeService())
                    {
                        Mapper.Map(scrimType, dto);
                        if (scrimType.ID > 0)
                        {
                            service.Update(dto);
                        }
                        else
                        {
                            dto.PlantID = CurrentPlantId;
                            service.Add(dto);
                        }
                    }
                }

                responseMessage = SetResponseMesssage(ActionTypeMessage.SuccessfulSave);
            }
            catch (Exception exc)
            {
                responseMessage = SetResponseMesssage(ActionTypeMessage.FailedSave, exc.Message);
            }

            return(Json(responseMessage, JsonRequestBehavior.AllowGet));
        }
示例#3
0
 private static ScrimTypeModel Bind(TPO.DL.Models.ScrimType entity, ScrimTypeModel to)
 {
     to.ID      = entity.ID;
     to.PlantID = entity.PlantID;
     to.WidthUnitOfMeasureID  = entity.WidthUoMID;
     to.WeightUnitOfMeasureID = entity.WeightUoMID;
     to.LengthUnitOfMeasureID = entity.LengthUoMID;
     to.Code         = entity.Code;
     to.Description  = entity.Description;
     to.Width        = (decimal)entity.Width;
     to.Length       = (decimal)entity.Length;
     to.Weight       = (decimal)entity.Weight;
     to.IsLiner      = entity.IsLiner;
     to.LastModified = entity.LastModified;
     return(to);
 }