Exemplo n.º 1
0
 private void EditValue(string iLanguageKeyId)
 {
     //Nếu key language chưa có giá trị
     if (SetCountItem(iLanguageKeyId).Equals("0"))
     {
         for (int i = 0; i <= RpListLanguageNationals.Items.Count - 1; i++)
         {
             TextBox tbTitle = (TextBox)RpListLanguageNationals.Items[i].FindControl(("TbLanguageWord"));
             string  value   = tbTitle.Text.Replace("'", "''");
             if (tbTitle.ToolTip.Equals(iLanguageKeyId))
             {
                 LanguageItem.InsertLanguageItem(language, iLanguageKeyId, value, "", "");
             }
         }
     }
     else //Nếu key language có giá trị rồi
     {
         for (int i = 0; i <= RpListLanguageNationals.Items.Count - 1; i++)
         {
             TextBox tbTitle = (TextBox)RpListLanguageNationals.Items[i].FindControl(("TbLanguageWord"));
             string  value   = tbTitle.Text.Replace("'", "''");
             if (tbTitle.ToolTip.Equals(iLanguageKeyId))
             {
                 string[] fields    = { "nLanguageItemTitle" };
                 string[] values    = { "N'" + value + "'" };
                 string   condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(iLanguageKeyId),
                                                                LanguageItemTSql.GetByiLanguageNationalId(language));
                 LanguageItem.UpdateLanguageItem(DataExtension.UpdateTransfer(fields, values), condition);
             }
         }
     }
 }
Exemplo n.º 2
0
    protected string GetImageItem(string iLanguageKeyId)
    {
        top       = "1";
        fields    = LanguageItemColumns.nLanguageItemParams;;
        condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(iLanguageKeyId),
                                              LanguageItemTSql.GetByiLanguageNationalId(language));
        order = "";
        DataTable dt = new DataTable();

        dt = LanguageItem.GetLanguageItem(top, fields, condition, order);
        string s = "";

        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0][LanguageItemColumns.nLanguageItemParams].ToString().Length > 0)
            {
                s = "<img src='" + UrlExtension.WebisteUrl + FolderPic.Language + "/" + dt.Rows[0][LanguageItemColumns.nLanguageItemParams].ToString() + "' class='anhtukhoa' id='img" + iLanguageKeyId + "'/>";
            }
            else
            {
                s = "<img src='" + UrlExtension.WebisteUrl + "pic/icon/no_image.gif' class='anhtukhoa' id='img" + iLanguageKeyId + "'/>";
            }
        }
        else
        {
            s = "<img src='" + UrlExtension.WebisteUrl + "pic/icon/no_image.gif' class='anhtukhoa' id='img" + iLanguageKeyId + "'/>";
        }
        return(s);
    }
Exemplo n.º 3
0
    string SetCountItem(string iLanguageKeyId)
    {
        top       = "1";
        fields    = " * ";
        condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(iLanguageKeyId),
                                              LanguageItemTSql.GetByiLanguageNationalId(language));
        order = "";
        DataTable dt = new DataTable();

        dt = LanguageItem.GetLanguageItem(top, fields, condition, order);
        return(dt.Rows.Count.ToString());
    }
Exemplo n.º 4
0
    void LoadInfo()
    {
        top       = "1";
        fields    = LanguageItemColumns.nLanguageItemParams;
        condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(iLanguageKeyId),
                                              LanguageItemTSql.GetByiLanguageNationalId(language));
        order = "";
        DataTable dt = new DataTable();

        dt = LanguageItem.GetLanguageItem(top, fields, condition, order);
        if (dt.Rows.Count > 0)
        {
            hdOldImage.Value = dt.Rows[0][LanguageItemColumns.nLanguageItemParams].ToString();
            hdUpdate.Value   = "1";
            ltrImage.Text    = ImagesExtension.GetImage(folderpic, hdOldImage.Value, "", "", false, false, "");
        }
    }
Exemplo n.º 5
0
    protected string GetWordItem(string iLanguageKeyId)
    {
        top       = "1";
        fields    = " * ";
        condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(iLanguageKeyId),
                                              LanguageItemTSql.GetByiLanguageNationalId(language));
        order = "";
        DataTable dt = new DataTable();

        dt = LanguageItem.GetLanguageItem(top, fields, condition, order);
        string s = "";

        if (dt.Rows.Count > 0)
        {
            s = dt.Rows[0]["nLanguageItemTitle"].ToString();
        }
        return(s);
    }
Exemplo n.º 6
0
    protected void TextChanged(object sender, EventArgs e)
    {
        TextBox textbox = sender as TextBox;

        if (SetCountItem(textbox.ToolTip).Equals("0")) //Nếu key language chưa có giá trị, insert mới
        {
            string value = textbox.Text.Replace("'", "''");
            LanguageItem.InsertLanguageItem(language, textbox.ToolTip, value, "", "");
        }
        else//Nếu key language có giá trị rồi, update
        {
            string   value     = textbox.Text.Replace("'", "''");
            string[] fields    = { "nLanguageItemTitle" };
            string[] values    = { "N'" + value + "'" };
            string   condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(textbox.ToolTip),
                                                           LanguageItemTSql.GetByiLanguageNationalId(language));
            LanguageItem.UpdateLanguageItem(DataExtension.UpdateTransfer(fields, values), condition);
        }
    }
Exemplo n.º 7
0
    protected void btOK_Click(object sender, EventArgs e)
    {
        #region Image
        string vimg = "";
        if (flimg.FileName.Length > 0 && flimg.PostedFile.ContentLength > 0)
        {
            string filename = "";
            filename = System.IO.Path.GetFileName(flimg.PostedFile.FileName);
            string fileex = "";

            fileex = System.IO.Path.GetExtension(filename).ToLower();
            if (fileex == ".jpg" || fileex == ".jpeg" || fileex == ".gif" || fileex == ".png" || fileex == ".bmp" || fileex == ".JPG" || fileex == ".JPEG" || fileex == ".GIF" || fileex == ".PNG" || fileex == ".BMP")
            {
                string fileNotEx = System.IO.Path.GetFileNameWithoutExtension(flimg.PostedFile.FileName);
                vimg = StringExtension.ReplateTitle(fileNotEx) + DateTime.Now.Ticks.ToString() + fileex;
                flimg.SaveAs(Request.PhysicalApplicationPath + "/" + folderpic + "/" + vimg);
            }
        }
        #endregion
        if (hdUpdate.Value == "1")//Cập nhật
        {
            if (vimg.Length > 0)
            {
                string[] fields    = { TatThanhJsc.Columns.LanguageItemColumns.nLanguageItemParams };
                string[] values    = { "N'" + vimg + "'" };
                string   condition = DataExtension.AndConditon(LanguageItemTSql.GetByiLanguageKeyId(iLanguageKeyId),
                                                               LanguageItemTSql.GetByiLanguageNationalId(language));
                LanguageItem.UpdateLanguageItem(DataExtension.UpdateTransfer(fields, values), condition);
                //Xoá ảnh cũ
                ImagesExtension.DeleteImageWhenDeleteItem(folderpic, hdOldImage.Value);
            }
            else
            {
                vimg = hdOldImage.Value;
            }
        }
        else//Thêm mới
        {
            LanguageItem.InsertLanguageItem(language, iLanguageKeyId, "", "", vimg);
        }
        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Cập nhật thành công');ChangeImage('img" + iLanguageKeyId + "','" + UrlExtension.WebisteUrl + folderpic + "/" + vimg + "');window.close();", true);
    }