Exemplo n.º 1
0
        /// <summary>
        /// Do multiple actions to selected (checked) records
        /// Actions such as Delete, Active, No active, Block, No block ...etc.
        /// </summary>
        /// <param name="manner">The action manner</param>
        /// <param name="value">True or False</param>
        /// <returns></returns>
        protected void DoMultiAction(string manner, bool value = false)
        {
            bool action = false; string message = null;

            foreach (RepeaterItem item in repeaterData.Items)
            {
                var checkBox = item.FindControl("checkBxSelector") as CheckBox;
                var lbIdValue = item.FindControl("lbIdValue") as Label;

                this.ContactUsID = short.Parse(lbIdValue.Text);
                if (checkBox.Checked)// Check the checked CheckBoxes
                {
                    if (manner == "DELETE")
                    {
                        action = this.LinqDeleteData();
                        message = Properties.Resources.NoDelete;
                    }
                }
            }
            // Checking the action
            if (action == true)
                this.LinqFetchData();
            else // Obstruct: Not allowed to Delete or No Data has been seleccted !IMPORTANT
            {
                BaseSys.NoAction(lbMultiActMsg, message);
            }
        }
Exemplo n.º 2
0
        // Delete Icon
        protected void lnkBtnDelete_Click(object sender, EventArgs e)
        {
            //----------------------------------------------
            LinkButton lnkBtnDelete = (LinkButton)sender;
            //----------------------------------------------

            this.ContactUsID = Convert.ToInt16(lnkBtnDelete.CommandArgument);

            if (this.LinqDeleteData() == true)
                this.LinqFetchData();
            else
                BaseSys.NoAction(lbMultiActMsg, Properties.Resources.NoDelete);
        }
        // Delete ImagePath
        protected void lnkBtnDelete_Click(object sender, EventArgs e)
        {
            //----------------------------------------------
            LinkButton lnkBtnDelete = (LinkButton)sender;
            //----------------------------------------------

            this.CategoryID = Convert.ToInt16(lnkBtnDelete.CommandArgument);

            if (this.LinqDeleteXmlData() == true)
            {
                this.LinqFetchXmlData(); BaseSys.DeleteImageFile(this.ImagePath);
            }
            else
                BaseSys.NoAction(lbMultiActMsg, Properties.Resources.NoDelete);
        }