Beispiel #1
0
        private void SaveInfo(string strLink = "")
        {
            try
            {
                string Color_Name     = txtName.Value;
                string Color_Desc     = txtDesc.Value;
                int    Color_Active   = Utils.CIntDef(rblStatus.SelectedValue);
                int    Color_Priority = Utils.CIntDef(txtOrder.Value);

                if (m_color_id == 0)
                {
                    //insert

                    ESHOP_COLOR cat_insert = new ESHOP_COLOR();

                    cat_insert.COLOR_NAME     = Color_Name;
                    cat_insert.COLOR_DESC     = Color_Desc;
                    cat_insert.COLOR_ACTIVE   = Color_Active;
                    cat_insert.COLOR_PRIORITY = Color_Priority;

                    DB.ESHOP_COLORs.InsertOnSubmit(cat_insert);
                    DB.SubmitChanges();

                    var _cat = DB.GetTable <ESHOP_COLOR>().OrderByDescending(g => g.COLOR_ID).Take(1);

                    m_color_id = _cat.Single().COLOR_ID;

                    strLink = string.IsNullOrEmpty(strLink) ? "color.aspx?color_id=" + m_color_id : strLink;
                }
                else
                {
                    //update
                    var c_update = DB.GetTable <ESHOP_COLOR>().Where(g => g.COLOR_ID == m_color_id);

                    if (c_update.ToList().Count > 0)
                    {
                        c_update.Single().COLOR_NAME     = Color_Name;
                        c_update.Single().COLOR_DESC     = Color_Desc;
                        c_update.Single().COLOR_PRIORITY = Color_Priority;
                        c_update.Single().COLOR_ACTIVE   = Color_Active;

                        DB.SubmitChanges();

                        strLink = string.IsNullOrEmpty(strLink) ? "color_list.aspx" : strLink;
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
        private void SaveInfo(string strLink = "")
        {
            try
            {
                string Color_Name = txtName.Value;
                string Color_Desc = txtDesc.Value;
                int Color_Active = Utils.CIntDef(rblStatus.SelectedValue);
                int Color_Priority = Utils.CIntDef(txtOrder.Value);

                if (m_color_id == 0)
                {
                    //insert

                    ESHOP_COLOR cat_insert = new ESHOP_COLOR();

                    cat_insert.COLOR_NAME = Color_Name;
                    cat_insert.COLOR_DESC = Color_Desc;
                    cat_insert.COLOR_ACTIVE = Color_Active;
                    cat_insert.COLOR_PRIORITY = Color_Priority;

                    DB.ESHOP_COLORs.InsertOnSubmit(cat_insert);
                    DB.SubmitChanges();

                    var _cat = DB.GetTable<ESHOP_COLOR>().OrderByDescending(g => g.COLOR_ID).Take(1);

                    m_color_id = _cat.Single().COLOR_ID;

                    strLink = string.IsNullOrEmpty(strLink) ? "color.aspx?color_id=" + m_color_id : strLink;
                }
                else
                {
                    //update
                    var c_update = DB.GetTable<ESHOP_COLOR>().Where(g => g.COLOR_ID == m_color_id);

                    if (c_update.ToList().Count > 0)
                    {
                        c_update.Single().COLOR_NAME = Color_Name;
                        c_update.Single().COLOR_DESC = Color_Desc;
                        c_update.Single().COLOR_PRIORITY = Color_Priority;
                        c_update.Single().COLOR_ACTIVE = Color_Active;

                        DB.SubmitChanges();

                        strLink = string.IsNullOrEmpty(strLink) ? "color_list.aspx" : strLink;
                    }
                }

            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                { Response.Redirect(strLink); }
            }
        }