示例#1
0
 internal int InsertColor(LC_Color objColor)
 {
     try
     {
         _context.LC_Color.AddObject(objColor);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 internal int UpdateColor(LC_Color objcol, int colorId)
 {
     try
     {
         LC_Color obj = _context.LC_Color.First(x => x.ColorId == colorId);
         obj.ColorName = objcol.ColorName;
         obj.Status    = objcol.Status;
         obj.Edit_User = objcol.Edit_User;
         obj.Edit_Date = objcol.Edit_Date;
         _context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
        private bool IsExist(string Cname)
        {
            try
            {
                ERPSSL_MerchandisingEntities _context = new ERPSSL_MerchandisingEntities();

                LC_Color objColor = new LC_Color();

                bool status = false;
                int  count  = (from col in _context.LC_Color
                               where col.ColorName == Cname
                               select col.ColorId).Count();
                if (count == 0)
                {
                    status = true;
                }

                return(status);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#4
0
        protected void btnColorSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtColor.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Color Name!')", true);
                }
                else
                {
                    LC_Color objColor = new LC_Color();
                    objColor.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;
                    objColor.Edit_Date = DateTime.Now;
                    objColor.OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                    objColor.ColorName = txtColor.Text;
                    objColor.Status    = drpStatus.SelectedItem.Text;

                    if (btnColorSubmit.Text == "Submit")
                    {
                        if (IsExist(objColor.ColorName))
                        {
                            int result = objColor_BLL.InsertColor(objColor);
                            if (result == 1)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save successfully!')", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true);
                        }
                    }
                    else
                    {
                        if (hidColorName.Value != txtColor.Text)
                        {
                            if (IsExist(objColor.ColorName))
                            {
                                int colorId = Convert.ToInt32(hidColorId.Value);
                                int result  = objColor_BLL.UpdateColor(objColor, colorId);
                                if (result == 1)
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update successfully!')", true);
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true);
                            }
                        }
                        else
                        {
                            int colorId = Convert.ToInt32(hidColorId.Value);
                            int result  = objColor_BLL.UpdateColor(objColor, colorId);
                            if (result == 1)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update successfully!')", true);
                            }
                        }
                    }
                    GetColors();
                    ClearColorsUi();
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
示例#5
0
 internal int UpdateColor(LC_Color objcol, int colorId)
 {
     return(objColor_Dal.UpdateColor(objcol, colorId));
 }
示例#6
0
 internal int InsertColor(LC_Color objColor)
 {
     return(objColor_Dal.InsertColor(objColor));
 }