Exemple #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));
        }
Exemple #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));
        }
        protected void CalcArea()
        {
            int areaUoMId = 0;

            using (ScrimTypeService service = new ScrimTypeService())
            {
                _area = 0.0;
                ScrimTypeDto dto = service.Get(TypeID);
                _area     = (double)Length * dto.Width;
                areaUoMId = dto.AreaUoMID;
            }
            using (UnitOfMeasureService service = new UnitOfMeasureService())
            {
                _areaUom = service.Get(areaUoMId).Code;
            }
        }