Ejemplo n.º 1
0
        private void SaveInfo(string strLink = "")
        {
            try
            {
                if (_id == 0)
                {
                    ESHOP_SHOP insert = new ESHOP_SHOP();

                    insert.NAME    = txtName.Value;
                    insert.PHONE   = txtPhone.Value;
                    insert.ADDRESS = txtAddress.Value;
                    insert.EMAIL   = txtEmail.Value;
                    insert.WEBSITE = txtWebsite.Value;
                    insert.FIELD1  = ddlUser.SelectedValue;

                    insert.SEO_URL     = txtSeoUrl.Value;
                    insert.SEO_TITLE   = txtSeoTitle.Value;
                    insert.SEO_KEYWORD = txtSeoKeyword.Value;
                    insert.SEO_DESC    = txtSeoDescription.Value;

                    DB.ESHOP_SHOPs.InsertOnSubmit(insert);
                    DB.SubmitChanges();
                    strLink = string.IsNullOrEmpty(strLink) ? "shop.aspx?id=" + insert.ID + "" : strLink;
                }
                else
                {
                    //update
                    var c_update = DB.GetTable <ESHOP_SHOP>().Where(g => g.ID == _id);

                    if (c_update.ToList().Count > 0)
                    {
                        c_update.Single().NAME    = txtName.Value;
                        c_update.Single().PHONE   = txtPhone.Value;
                        c_update.Single().ADDRESS = txtAddress.Value;
                        c_update.Single().EMAIL   = txtEmail.Value;
                        c_update.Single().WEBSITE = txtWebsite.Value;
                        c_update.Single().FIELD1  = ddlUser.SelectedValue;

                        c_update.Single().SEO_URL     = txtSeoUrl.Value;;
                        c_update.Single().SEO_TITLE   = txtSeoTitle.Value;;
                        c_update.Single().SEO_KEYWORD = txtSeoKeyword.Value;
                        c_update.Single().SEO_DESC    = txtSeoDescription.Value;

                        DB.SubmitChanges();

                        strLink = string.IsNullOrEmpty(strLink) ? "shop.aspx?id=" + c_update.Single().ID + "" : strLink;
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
Ejemplo n.º 2
0
        private void SaveInfo(string strLink = "")
        {
            try
            {      
                if (_id == 0)
                {
                    ESHOP_SHOP insert = new ESHOP_SHOP();

                    insert.NAME = txtName.Value;
                    insert.PHONE = txtPhone.Value;
                    insert.ADDRESS = txtAddress.Value;
                    insert.EMAIL = txtEmail.Value;
                    insert.WEBSITE = txtWebsite.Value;
                    insert.FIELD1 = ddlUser.SelectedValue;

                    insert.SEO_URL = txtSeoUrl.Value;
                    insert.SEO_TITLE = txtSeoTitle.Value;
                    insert.SEO_KEYWORD = txtSeoKeyword.Value;
                    insert.SEO_DESC = txtSeoDescription.Value;
                    
                    DB.ESHOP_SHOPs.InsertOnSubmit(insert);
                    DB.SubmitChanges();
                    strLink = string.IsNullOrEmpty(strLink) ? "shop.aspx?id=" + insert.ID + "" : strLink;
                }
                else
                {
                    //update
                    var c_update = DB.GetTable<ESHOP_SHOP>().Where(g => g.ID == _id);

                    if (c_update.ToList().Count > 0)
                    {
                        c_update.Single().NAME = txtName.Value;
                        c_update.Single().PHONE = txtPhone.Value;
                        c_update.Single().ADDRESS = txtAddress.Value;
                        c_update.Single().EMAIL = txtEmail.Value;
                        c_update.Single().WEBSITE = txtWebsite.Value;
                        c_update.Single().FIELD1 = ddlUser.SelectedValue;

                        c_update.Single().SEO_URL = txtSeoUrl.Value; ;
                        c_update.Single().SEO_TITLE = txtSeoTitle.Value; ;
                        c_update.Single().SEO_KEYWORD = txtSeoKeyword.Value;
                        c_update.Single().SEO_DESC = txtSeoDescription.Value;

                        DB.SubmitChanges();

                        strLink = string.IsNullOrEmpty(strLink) ? "shop.aspx?id=" + c_update.Single().ID + "" : strLink;
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                { Response.Redirect(strLink); }
            }
        }