Ejemplo n.º 1
0
 protected void grdContact_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Contact> listE = ContactService.Contact_GetById(Id);
             txtName.Text = listE[0].Name;
             txtCompany.Text = listE[0].Company;
             txtAddress.Text = listE[0].Address;
             txtTel.Text = listE[0].Tel;
             txtMail.Text = listE[0].Mail;
             fckDetail.Value = listE[0].Detail;
             txtDate.Text = DateTimeClass.ConvertDateTime(listE[0].Date);
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update Contact set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             ContactService.Contact_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 2
0
 protected void grdLink_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Link> listE = LinkService.Link_GetById(Id);
             txtName.Text = listE[0].Name;
             txtLine1.Text = listE[0].Line1;
             txtLine2.Text = listE[0].Line2;
             txtLink1.Text = listE[0].Link1;
             txtLink2.Text = listE[0].Link2;
             txtPosition.Text = listE[0].Position;
             txtOrd.Text = listE[0].Ord;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update Link set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             LinkService.Link_Delete(strCA);
             BindGrid();
             break;
     }
 }
 protected void grdLanguage_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Language> listE = LanguageService.Language_GetById(Id);
             txtName.Text = listE[0].Name;
             txtFolder.Text = listE[0].Folder;
             chkDefault.Checked = listE[0].Default == "1" || listE[0].Default == "True";
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update Language set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             LanguageService.Language_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 4
0
 protected void grdMember_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Member> listE = MemberService.Member_GetById(Id);
             txtName.Text = listE[0].Name;
             txtEmail.Text = listE[0].Email;
             txtUsername.Text = listE[0].Username;
             txtPassword.Text = "";
             Password = listE[0].Password;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             LoadGroupMemberDropDownList();
             ddlGroupMember.Text = listE[0].GroupMemberId;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [Member] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             MemberService.Member_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 5
0
 protected void grdLibrary_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Library> listE = LibraryService.Library_GetById(Id);
             txtName.Text = listE[0].Name;
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             txtFile.Text = listE[0].File;
             fckInfo.Value = listE[0].Info;
             chkPriority.Checked = listE[0].Priority == "1" || listE[0].Priority == "True";
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             LoadGroupLibraryDropDownList();
             ddlGroupLibrary.Text = listE[0].GroupLibraryId;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [Library] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             LibraryService.Library_Delete(strCA);
             BindGrid();
             break;
     }
 }
 protected void grdNewsCategory_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.NewsCategory> listE = NewsCategoryService.NewsCategory_GetById(Id);
             txtName.Text = listE[0].Name;
             txtOrd.Text = listE[0].Ord;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             txtTitle.Text = listE[0].Title;
             txtMetaKeyword.Text = listE[0].MetaKeyword;
             txtDescription.Text = listE[0].Description;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [NewsCategory] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             NewsCategoryService.NewsCategory_Delete(strCA);
             BindGrid();
             break;
     }
 }
 protected void grdDocument_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Document> listE = DocumentService.Document_GetById(Id);
             txtCode.Text = listE[0].Code;
             txtName.Text = listE[0].Name;
             txtCreateDate.Text = DateTimeClass.ConvertDate(listE[0].CreateDate);
             txtEffectiveDate.Text = DateTimeClass.ConvertDate(listE[0].EffectiveDate);
             fckInfo.Value = listE[0].Info;
             txtFile.Text = listE[0].File;
             chkPriority.Checked = listE[0].Priority == "1" || listE[0].Priority == "True";
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             LoadDocumentTypeDropDownList();
             LoadMemberDropDownList();
             ddlDocumentType.Text = listE[0].TypeId;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update Document set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             DocumentService.Document_Delete(strCA);
             BindGrid();
             break;
     }
 }
 protected void grdGroupLibrary_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "AddSub":
             Level = strCA;
             AddButton_Click(source, e);
             break;
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.GroupLibrary> listE = GroupLibraryService.GroupLibrary_GetById(Id);
             Level = listE[0].Level.Substring(0, listE[0].Level.Length - 5);
             txtName.Text = listE[0].Name;
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             txtOrd.Text = listE[0].Ord;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [GroupLibrary] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             GroupLibraryService.GroupLibrary_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 9
0
 protected void grdNews_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.News> listE = NewsService.News_GetById(Id);
             txtName.Text = listE[0].Name;
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             txtContent.Text = listE[0].Content;
             fckDetail.Value = listE[0].Detail;
             txtDate.Text = DateTimeClass.ConvertDateTime(listE[0].Date);
             txtTitle.Text = listE[0].Title;
             txtDescription.Text = listE[0].Description;
             txtKeyword.Text = listE[0].Keyword;
             chkPriority.Checked = listE[0].Priority == "1" || listE[0].Priority == "True";
             chkIndex.Checked = listE[0].Index == "1" || listE[0].Index == "True";
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             LoadGroupNewsDropDownList();
             ddlGroupNews.Text = listE[0].GroupNewsId;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update News set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             NewsService.News_Delete(strCA);
             BindGrid();
             break;
     }
 }
 protected void grdAdvertise_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Advertise> listE = AdvertiseService.Advertise_GetById(Id);
             txtName.Text = listE[0].Name;
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             txtWidth.Text = listE[0].Width;
             txtHeight.Text = listE[0].Height;
             txtLink.Text = listE[0].Link;
             txtTarget.Text = listE[0].Target;
             fckContent.Value = listE[0].Content;
             cboPosition.SelectedValue = listE[0].Position;
             txtClick.Text = listE[0].Click;
             txtOrd.Text = listE[0].Ord;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             LoadPageLinkDropDownList();
             ddlPageLink.Text = listE[0].PageLinkId;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [Advertise] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             AdvertiseService.Advertise_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 11
0
 protected void grdCategory_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     string strWhere = " 1=1 ";
     DataGridItem item = default(DataGridItem);
     switch (e.CommandName)
     {
         case "AddSub":
             Level = strCA;
             AddButton_Click(source, e);
             break;
         case "Edit":
             Insert = false;
             txtId.Value = strCA;
             List<Data.Category> listE = CategoryService.Category_GetById(strCA);
             Level = listE[0].Level.Substring(0, listE[0].Level.Length - 5);
             txtName.Text = listE[0].Name;
             fckContent.Value = listE[0].Content;
             chkPriority.Checked = listE[0].Priority == "1" || listE[0].Priority == "True";
             chkIndex.Checked = listE[0].Index == "1" || listE[0].Index == "True";
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             txtTitle.Text = listE[0].Title;
             txtDescription.Text = listE[0].Description;
             txtKeyword.Text = listE[0].Keyword;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             txtOrd.Text = listE[0].Ord;
              txtImage2.Text = listE[0].Image2;
             imgImage2.ImageUrl = listE[0].Image2.Length > 0 ? listE[0].Image2 : "";
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [Category] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             List<Data.Product> list = new List<Product>();
             list = ProductService.Product_GetByCatelogy(strCA);
             if (list.Count > 0)
             {
                 Common.WebMsgBox.Show("Không thể xóa nhóm sản phẩm đang có dữ liệu!");
                 return;
             }
             else
             {
                 CategoryService.Category_Delete(strCA);
             }
             BindGrid();
             break;
         #region[Sort Name asc]
         case "ascname":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Name");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Name desc]
         case "descname":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Name desc");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Priority asc]
         case "ascpriority":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Priority");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Priority desc]
         case "descpriority":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Priority desc");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Index asc]
         case "ascindex":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "[Index]");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Index desc]
         case "descindex":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "[Index] desc");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Active asc]
         case "ascactive":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Active");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Active desc]
         case "descactive":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Active desc");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Ord asc]
         case "ascord":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Ord");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
         #region[Sort Ord desc]
         case "descord":
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and Name like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Active = '" + ddlFilterActive.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomtrangchu.SelectedValue))
             {
                 strWhere += " and [Index] = '" + drlNhomtrangchu.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(drlNhomuutien.SelectedValue))
             {
                 strWhere += " and Priority = '" + drlNhomuutien.SelectedValue + "' ";
             }
             grdCategory.DataSource = CategoryService.Category_GetByTop("", strWhere, "Ord desc");
             grdCategory.DataBind();
             for (int i = 0; i < grdCategory.Items.Count; i++)
             {
                 item = grdCategory.Items[i];
                 TextBox stxtOrd = ((TextBox)item.FindControl("txtOrd"));
                 NumberClass.OnlyInputNumber(stxtOrd);
             }
             if (grdCategory.PageCount <= 1)
             {
                 grdCategory.PagerStyle.Visible = false;
             }
             break;
         #endregion
     }
 }
 protected void grdGroupNews_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "AddSub":
             Level = strCA;
             AddButton_Click(source, e);
             break;
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.GroupImage> listE = Business.GroupImageService.GroupImage_GetById(Id);
             Level = listE[0].Level.Substring(0, listE[0].Level.Length - 5);
             txtName.Text = listE[0].Name;
             txtTitle.Text = listE[0].Title;
             txtDescription.Text = listE[0].Description;
             txtKeyword.Text = listE[0].Keyword;
             txtOrd.Text = listE[0].Ord;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             //chkIndex.Checked = listE[0].Index == "1" || listE[0].Index == "True";
             rbtUutien.SelectedValue = listE[0].Index;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update GroupImage set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             GroupImageService.GroupImage_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 13
0
 protected void grdProduct_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Product> listE = ProductService.Product_GetById(Id);
             txtName.Text = listE[0].Name;
             txtTitle.Text = listE[0].Title;
             fckContent.Value = listE[0].Content;
             txtUnit.Text = listE[0].Unit;
             txtDecription.Text = listE[0].Decription;
             txtMetaKeyword.Text = listE[0].MetaKeyword;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             txtSalePrice.Text = NumberClass.ConvertNumber(listE[0].SalePrice);
             txtImage.Text = listE[0].Image;
             imgImage.ImageUrl = listE[0].Image.Length > 0 ? listE[0].Image : "";
             txtImage1.Text = listE[0].Image1;
             imgImage1.ImageUrl = listE[0].Image1.Length > 0 ? listE[0].Image1 : "";
             txtImage2.Text = listE[0].Image2;
             imgImage2.ImageUrl = listE[0].Image2.Length > 0 ? listE[0].Image2 : "";
             txtImage3.Text = listE[0].Image3;
             imgImage3.ImageUrl = listE[0].Image3.Length > 0 ? listE[0].Image3 : "";
             txtImage4.Text = listE[0].Image4;
             imgImage4.ImageUrl = listE[0].Image4.Length > 0 ? listE[0].Image4 : "";
             txtImage5.Text = listE[0].Image5;
             imgImage5.ImageUrl = listE[0].Image5.Length > 0 ? listE[0].Image5 : "";
             fckDetail.Value = listE[0].Detail;
             txtProductCode.Text = listE[0].ProductCode;
             createdDate = listE[0].CreatedDate;
             txtUnitPrice.Text = NumberClass.ConvertNumber(listE[0].UnitPrice);
             LoadProductCategoryDropDownList();
             ddlProductCategory.Text = listE[0].ProductCategoryID;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update [Product] set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             ProductService.Product_Delete(strCA);
             BindGrid();
             break;
     }
 }
Ejemplo n.º 14
0
 protected void grdSupport_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     string strCA = e.CommandArgument.ToString();
     switch (e.CommandName)
     {
         case "Edit":
             Insert = false;
             Id = strCA;
             List<Data.Support> listE = SupportService.Support_GetById(Id);
             txtName.Text = listE[0].Name;
             txtTel.Text = listE[0].Tel;
             PageHelper.LoadDropDownListSupportType(ddlType);
             ddlType.Text = listE[0].Type;
             txtNick.Text = listE[0].Nick;
             txtOrd.Text = listE[0].Ord;
             loadddlkhuvuc();
             ddlkhuvuc.SelectedValue = listE[0].Location;
             chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True";
             LoadGroupSupportDropDownList();
             ddlGroupSupport.Text = listE[0].GroupSupportId;
             pnView.Visible = false;
             pnUpdate.Visible = true;
             break;
         case "Active":
             string strA = "";
             string str = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             SqlDataProvider sql = new SqlDataProvider();
             sql.ExecuteNonQuery("Update Support set Active=" + strA + "  Where Id='" + strCA + "'");
             BindGrid();
             break;
         case "Delete":
             SupportService.Support_Delete(strCA);
             BindGrid();
             break;
     }
 }