Exemple #1
0
        public ValidationMsg Update(SysColor model, int userid)
        {
            var vmMsg = new ValidationMsg();

            try
            {
                var sysColor = _context.Sys_Color.FirstOrDefault(s => s.ColorID == model.ColorID);
                if (sysColor != null)
                {
                    sysColor.ColorCode  = model.ColorCode;
                    sysColor.ColorName  = model.ColorName;
                    sysColor.IsActive   = model.IsActive == "Active";
                    sysColor.ModifiedOn = DateTime.Now;
                    sysColor.ModifiedBy = userid;
                }
                _context.SaveChanges();

                vmMsg.Type = Enums.MessageType.Update;
                vmMsg.Msg  = "Updated Successfully.";
            }
            catch (Exception ex)
            {
                if (ex.InnerException.InnerException.Message.Contains("UNIQUE KEY"))
                {
                    vmMsg.Type = Enums.MessageType.Error;
                    vmMsg.Msg  = "Color Code Already Exit.";
                }
                else
                {
                    vmMsg.Type = Enums.MessageType.Error;
                    vmMsg.Msg  = "Failed to Update.";
                }
            }
            return(vmMsg);
        }
        private SysColor SetToColorModel(Sys_Color entity)
        {
            var model = new SysColor();

            model.ColorID   = entity.ColorID;
            model.ColorName = entity.ColorName;
            model.ColorCode = entity.ColorCode;
            return(model);
        }
Exemple #3
0
        public ActionResult GetColorList(string color)
        {
            var sysColor  = new SysColor();
            var colorList = _dalSlsBuyerOrder.GetColorList(color);

            //sysBuyer.Count = lAgentList.Count > 1 ? 0 : 1;
            sysColor.ColorList = colorList;
            return(Json(sysColor, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Color(SysColor model)
 {
     if (model != null && model.ColorID != 0)
     {
         _vmMsg = _dalSysColor.Update(model, Convert.ToInt32(Session["UserID"]));
     }
     else
     {
         _vmMsg = _dalSysColor.Save(model, Convert.ToInt32(Session["UserID"]));
     }
     return(Json(new { ColorID = _dalSysColor.GetColorID(), msg = _vmMsg }));
 }
Exemple #5
0
        public Sys_Color SetToModelObject(SysColor model, int userid)
        {
            Sys_Color entity = new Sys_Color();

            entity.ColorID   = model.ColorID;
            entity.ColorCode = model.ColorCode;
            entity.ColorName = model.ColorName;
            entity.IsActive  = model.IsActive == "Active";
            entity.SetOn     = DateTime.Now;
            entity.SetBy     = userid;
            entity.IPAddress = string.Empty;
            return(entity);
        }
Exemple #6
0
        public ValidationMsg Save(SysColor model, int userid)
        {
            var vmMsg = new ValidationMsg();

            try
            {
                Sys_Color tblSysColor = SetToModelObject(model, userid);
                _context.Sys_Color.Add(tblSysColor);

                _context.SaveChanges();
                ColorID    = tblSysColor.ColorID;
                ColorCode  = model.ColorCode;
                vmMsg.Type = Enums.MessageType.Success;
                vmMsg.Msg  = "Saved Successfully.";
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    if (ex.InnerException.InnerException.Message.Contains("UNIQUE KEY"))
                    {
                        vmMsg.Type = Enums.MessageType.Error;
                        vmMsg.Msg  = "Color Code Already Exit.";
                    }
                    else
                    {
                        vmMsg.Type = Enums.MessageType.Error;
                        vmMsg.Msg  = "Failed to Save.";
                    }
                }
                else
                {
                    vmMsg.Type = Enums.MessageType.Error;
                    vmMsg.Msg  = "Failed to Save.";
                }
            }
            return(vmMsg);
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            // show the list box
            if (service != null && value is Light)
            {
                //service.ShowDialog();

                //DialogResult result = service.ShowDialog(colorDialog as Form);

                DialogResult result = colorDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    SysColor     color        = colorDialog.Color;
                    WhiskeyColor whiskeyColor = UIManager.convertColor(color);

                    Light l = (Light)value;
                    l.Color = whiskeyColor;
                }
            }

            return(value);
        }
Exemple #8
0
 public static Color GetSysColor(SysColor color)
 {
     return FromRGB(GetSysColor((int) color));
 }
Exemple #9
0
 public static Color GetSysColor(SysColor color)
 {
     return(FromRGB(GetSysColor((int)color)));
 }
Exemple #10
0
 public static extern int GetSysColor(SysColor nIndex);
Exemple #11
0
 public static extern IntPtr GetSysColorBrush(SysColor nIndex);