Esempio n. 1
0
    protected void lnkdelimg_Click(object sender, EventArgs e)
    {
        brandManager objcontent      = new brandManager();
        string       fullimagepath   = string.Empty;
        string       thumbimagepath  = string.Empty;
        string       rectimagepath   = string.Empty;
        string       mediumimagepath = string.Empty;

        fullimagepath   = Server.MapPath("../" + AppSettings.BRAND_ACTULE_ROOTURL + hdImage.Value);
        thumbimagepath  = Server.MapPath("../" + AppSettings.BRAND_THUMB_ROOTURL + hdImage.Value);
        rectimagepath   = Server.MapPath("../" + AppSettings.BRAND_THUMBRECT_ROOTURL + hdImage.Value);
        mediumimagepath = Server.MapPath("../" + AppSettings.BRAND_MEDIUM_ROOTURL + hdImage.Value);

        CommonFunctions.DeleteFile(fullimagepath);
        CommonFunctions.DeleteFile(thumbimagepath);
        CommonFunctions.DeleteFile(rectimagepath);
        CommonFunctions.DeleteFile(mediumimagepath);

        objcontent.idbrand   = Convert.ToInt32(Request.QueryString["id"]);
        objcontent.imagepath = "";
        objcontent.UpdateImage();
        //lblmsgs.Text = "Image deleted successfully";
        //reqimageg.Enabled = true;
        spimg.Visible     = false;
        hdImage.Value     = "";
        btncancel.Visible = false;
    }
Esempio n. 2
0
    public void UpdateBrandLanguage(int Id)
    {
        brandManager objbrandLanguage = new brandManager();

        try
        {
            for (int i = 0; i < Convert.ToInt32(hdtotallanguage.Value); i++)
            {
                objbrandLanguage.idbrand          = Id;
                objbrandLanguage.brandLanguage    = Convert.ToInt32(Request.Form["hdid" + (i + 1).ToString()]);
                objbrandLanguage.brandName        = Convert.ToString(Request.Form["txtbrandname" + (i + 1).ToString()]);
                objbrandLanguage.branddescription = Convert.ToString(Request.Form["txtbranddesname" + (i + 1).ToString()]);
                int lan = i + 1;
                objbrandLanguage.languageId = lan;
                if (objbrandLanguage.brandLanguage == 0)
                {
                    objbrandLanguage.InsertBrandLanguage();
                }
                else
                {
                    objbrandLanguage.UpdateBrandLnaguage();
                }
            }
        }
        catch (Exception ex) { throw ex; }
        finally { objbrandLanguage = null; }
    }
Esempio n. 3
0
    public List <brandManager> BindPopBrand()
    {
        // productManager objProduct = new productManager();
        brandManager        objBrand = new brandManager();
        List <brandManager> lmp      = new List <brandManager>();
        DataTable           dt       = new DataTable();

        //dt = objProduct.SKUBind();
        dt = objBrand.GetBrandItem();
        foreach (DataRow dr in dt.Rows)
        {
            brandManager CMS = new brandManager();
            CMS.idbrand   = Convert.ToInt32(dr["brandid"].ToString());
            CMS.brandName = dr["brandName"].ToString();
            lmp.Add(CMS);
        }
        return(lmp);
    }
Esempio n. 4
0
    public void InsertBrandLanguage(int brandId)
    {
        brandManager objbrandLanguage = new brandManager();

        try
        {
            for (int i = 0; i < Convert.ToInt32(hdtotallanguage.Value); i++)
            {
                objbrandLanguage.idbrand          = brandId;
                objbrandLanguage.languageId       = Convert.ToInt32(Request.Form["splangid" + (i + 1).ToString()]);
                objbrandLanguage.brandName        = Convert.ToString(Request.Form["txtbrandname" + (i + 1).ToString()]);
                objbrandLanguage.branddescription = Convert.ToString(Request.Form["txtbranddesname" + (i + 1).ToString()]);
                objbrandLanguage.InsertBrandLanguage();
            }
        }
        catch (Exception ex) { throw ex; }
        finally { objbrandLanguage = null; }
    }
Esempio n. 5
0
    private void BindBrandLanguageOnedit(int brandid)
    {
        DataTable    dtLanguages      = new DataTable();
        brandManager objbrandLanguage = new brandManager();

        try
        {
            string strLanguage = "";
            objbrandLanguage.idbrand = brandid;
            dtLanguages = objbrandLanguage.SelectBrandLanguagebyID();
            if (dtLanguages.Rows.Count > 0)
            {
                hdtotallanguage.Value = dtLanguages.Rows.Count.ToString();

                for (int i = 0; i < dtLanguages.Rows.Count; i++)
                {
                    if (i == 0)
                    {
                        strLanguage += "<input type='hidden' value='" + dtLanguages.Rows[i]["brandLanguage"].ToString() + "' name='hdid" + (i + 1).ToString() + "' id='hdid" + (i + 1).ToString() + "'>";
                        strLanguage += "<input type='text' value='" + dtLanguages.Rows[i]["languageid"].ToString() + "' name='splangid" + (i + 1).ToString() + "' id='splangid" + (i + 1).ToString() + "' style='display:none;' />";

                        strLanguage += "<div class='tab-pane active' id='" + dtLanguages.Rows[i]["languageName"].ToString() + "'>";
                        strLanguage += "<div class='form-group'><label for='inputName' class='col-sm-12 control-label'>Brand  Name </label><div class='col-sm-12'><input type='text' class='form-control' id='txtbrandname" + (i + 1).ToString() + "' value='" + dtLanguages.Rows[i]["brandName"].ToString() + "' maxlength='100' name='txtbrandname" + (i + 1).ToString() + "'/><div id='brandmessage' style='color:red'></div></div></div>";
                        strLanguage += "<div class='form-group'><label for='inputName' class='col-sm-12 control-label'>Brand Description </label><div class='col-sm-12'><textarea class='form-control' id='txtbranddesname" + (i + 1).ToString() + "'  maxlength='500' name='txtbranddesname" + (i + 1).ToString() + "' value='" + dtLanguages.Rows[i]["brandDescription"].ToString() + "'>" + dtLanguages.Rows[i]["brandDescription"].ToString() + "</textarea></div></div>";
                        strLanguage += "</div>";
                    }
                    else
                    {
                        strLanguage += "<input type='hidden' value='" + dtLanguages.Rows[i]["brandLanguage"].ToString() + "' name='hdid" + (i + 1).ToString() + "' id='hdid" + (i + 1).ToString() + "'>";
                        strLanguage += "<input type='text' value='" + dtLanguages.Rows[i]["languageid"].ToString() + "' name='splangid" + (i + 1).ToString() + "' id='splangid" + (i + 1).ToString() + "' style='display:none;' />";

                        strLanguage += "<div class='tab-pane' id='" + dtLanguages.Rows[i]["languageName"].ToString() + "'>";
                        strLanguage += "<div class='form-group'><label for='inputName' class='col-sm-12 control-label'>اسم العلامة التجارية</label><div class='col-sm-12'><input type='text' class='form-control' id='txtbrandname" + (i + 1).ToString() + "' value='" + dtLanguages.Rows[i]["brandName"].ToString() + "' maxlength='100' name='txtbrandname" + (i + 1).ToString() + "'/></div></div>";
                        strLanguage += "<div class='form-group'><label for='inputName' class='col-sm-12 control-label'>وصف العلامة التجارية</label><div class='col-sm-12'><textarea class='form-control' id='txtbranddesname" + (i + 1).ToString() + "'  maxlength='500' name='txtbranddesname" + (i + 1).ToString() + "' value='" + dtLanguages.Rows[i]["brandDescription"].ToString() + "'>" + dtLanguages.Rows[i]["brandDescription"].ToString() + "</textarea></div></div>";
                        strLanguage += "</div>";
                    }
                }
            }
            ltrcategorylanguages.Text = strLanguage.ToString();
        }
        catch (Exception ex) { throw ex; }
        finally { dtLanguages.Dispose(); dtLanguages.Clear(); }
    }
Esempio n. 6
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        //lblmsgs.Text = "";
        int maxID;

        if (Page.IsValid)
        {
            brandManager objbrandLanguage = new brandManager();

            for (int i = 0; i < Convert.ToInt32(hdtotallanguage.Value); i++)
            {
                if (i == 0)
                {
                    objBrand.brandName        = Convert.ToString(Request.Form["txtbrandname" + (i + 1).ToString()]); //Convert.ToInt32(Request.Form["splangid" + (i + 1).ToString()]);
                    objBrand.branddescription = Convert.ToString(Request.Form["txtbranddesname" + (i + 1).ToString()]);
                    objBrand.sortorder        = Convert.ToInt32(txtsortorder.Text);
                    objBrand.isactive         = Convert.ToByte(ddlactive.SelectedValue);

                    if (Request.QueryString["flag"] == "edit")
                    {
                        objBrand.idbrand = Convert.ToInt32(Request.QueryString["id"]);

                        UpdateBrandLanguage(objBrand.idbrand);

                        if (objBrand.TitleExist())
                        {
                            lblmsgdiv.Visible = true;
                            lblmsg.Visible    = false;
                            lblalert.Text     = "Brand already exists.";
                            return;
                        }

                        //// update brand image
                        //if (txtImageName.HasFile)
                        //{
                        //    objBrand.imagepath = UploadImage(Convert.ToInt32(Request.QueryString["id"]));
                        //}
                        //else
                        //{
                        //    objBrand.imagepath = hdImage.Value;
                        //}

                        HttpFileCollection uploadedFiles = Request.Files;
                        if (uploadedFiles.Count > 0)
                        {
                            for (int im = 0; im < uploadedFiles.Count; im++)
                            {
                                HttpPostedFile userPostedFile = uploadedFiles[im];
                                string         name           = userPostedFile.FileName;
                                if (name != "null" && name != "")
                                {
                                    string extension = Path.GetExtension(userPostedFile.FileName).ToString();
                                    string name2     = name.Replace(extension, "");
                                    string nameBox   = Request.Form["newr" + name2];
                                    if (nameBox == null)
                                    {
                                        string strImg = UploadImage(userPostedFile, Convert.ToInt32(Request.QueryString["id"]));
                                        if (strImg != "Noimage")
                                        {
                                            objBrand.imagepath = strImg;
                                        }
                                        else
                                        {
                                            objBrand.imagepath = "";
                                        }
                                    }
                                }
                                else
                                {
                                    objBrand.imagepath = hdImage.Value;
                                }
                            }
                        }
                        else
                        {
                            objBrand.imagepath = hdImage.Value;
                        }

                        objBrand.UpdateItem(Convert.ToInt32(hfprevsort.Value), Convert.ToInt32(txtsortorder.Text));
                        lblmsg.Visible = true;
                        lblmsgs.Text   = "Brand updated successfully";
                        Response.Redirect("add_brand.aspx?fg=edt&flag=" + Request.QueryString["edit"]);
                        //lblmsg.Visible = true;
                        //lblmsgs.Text = "Brand updated successfully";
                    }
                    else
                    {
                        objBrand.idbrand = 0;
                        if (objBrand.TitleExist())
                        {
                            lblmsgdiv.Visible = true;
                            lblmsg.Visible    = false;
                            lblalert.Text     = "Brand already exists.";
                            return;
                        }

                        objBrand.imagepath = "";
                        objBrand.idbrand   = 0;
                        objBrand.InsertItem();
                        maxID = objBrand.getmaxid();

                        InsertBrandLanguage(maxID);

                        ////insert brand image
                        //if (txtImageName.HasFile)
                        //{
                        //    objBrand.imagepath = UploadImage(maxID);
                        //}
                        //else
                        //{
                        //    objBrand.imagepath = "";
                        //}

                        HttpFileCollection uploadedFiles = Request.Files;
                        if (uploadedFiles.Count > 0)
                        {
                            for (int im = 0; im < uploadedFiles.Count; im++)
                            {
                                HttpPostedFile userPostedFile = uploadedFiles[im];
                                string         name           = userPostedFile.FileName;
                                if (name != "null" && name != "")
                                {
                                    string extension = Path.GetExtension(userPostedFile.FileName).ToString();
                                    string name2     = name.Replace(extension, "");
                                    string nameBox   = Request.Form["newr" + name2];
                                    if (nameBox == null)
                                    {
                                        string strImg = UploadImage(userPostedFile, maxID);
                                        if (strImg != "Noimage")
                                        {
                                            objBrand.imagepath = strImg;
                                        }
                                        else
                                        {
                                            objBrand.imagepath = "";
                                        }
                                    }
                                    else
                                    {
                                        objBrand.imagepath = "";
                                    }
                                }
                            }
                        }
                        else
                        {
                            objBrand.imagepath = "";
                        }


                        objBrand.idbrand = maxID;
                        objBrand.UpdateImage();

                        Response.Redirect("add_brand.aspx?flag=add&key=" + Request.QueryString["key"]);
                    }
                }
            }
        }
    }