コード例 #1
0
        public SysProductionProces SetToBussinessObject(Sys_ProductionProces Entity)
        {
            SysProductionProces Model = new SysProductionProces();

            Model.ProcessID       = Entity.ProcessID;
            Model.ProcessName     = Entity.ProcessName;
            Model.ProcessCategory = Entity.ProcessCategory;
            switch (Entity.ProcessCategory)
            {
            case "WB":
                Model.ProcessCategoryName = "Wet Blue";
                break;

            case "CR":
                Model.ProcessCategoryName = "Crust";
                break;

            case "FN":
                Model.ProcessCategoryName = "Finish";
                break;

            //case "FLP":
            //    Model.ProcessCategoryName = "Finished Leather Production";
            //    break;
            default:
                Model.ProcessCategoryName = "";
                break;
            }
            Model.ProcessLevel  = Entity.ProcessLevel;
            Model.ProcessEffect = Entity.ProcessEffect;
            switch (Entity.ProcessEffect)
            {
            case "NE":
                Model.ProcessEffectName = "No Effect";
                break;

            case "CL":
                Model.ProcessEffectName = "Consume Leather";
                break;

            case "CC":
                Model.ProcessEffectName = "Consume Chemical";
                break;

            case "CB":
                Model.ProcessEffectName = "Consume Both";
                break;

            default:
                Model.ProcessEffectName = "";
                break;
            }
            Model.IsActive = Entity.IsActive == true ? "Active" : "Inactive";

            return(Model);
        }
コード例 #2
0
        public Sys_ProductionProces SetToModelObject(SysProductionProces model)
        {
            Sys_ProductionProces entity = new Sys_ProductionProces();

            entity.ProcessID       = model.ProcessID;
            entity.ProcessName     = model.ProcessName;
            entity.ProcessCategory = model.ProcessCategory;
            entity.ProcessLevel    = model.ProcessLevel;
            entity.ProcessEffect   = model.ProcessEffect;
            entity.IsActive        = model.IsActive == "Active";
            entity.SetOn           = DateTime.Now;
            entity.SetBy           = 2;
            //SetBy = userid,
            entity.IPAddress = string.Empty;
            return(entity);
        }
コード例 #3
0
        public ValidationMsg Save(SysProductionProces model, int userid)
        {
            var vmMsg = new ValidationMsg();

            try
            {
                Sys_ProductionProces tblSysProductionProces = SetToModelObject(model);
                _context.Sys_ProductionProces.Add(tblSysProductionProces);
                _context.SaveChanges();
                ProcessID  = tblSysProductionProces.ProcessID;
                vmMsg.Type = Enums.MessageType.Success;
                vmMsg.Msg  = "Saved Successfully.";
            }
            catch (Exception ex)
            {
                vmMsg.Type = Enums.MessageType.Error;
                vmMsg.Msg  = "Failed to Save.";
            }
            return(vmMsg);
        }