Example #1
0
 public void rdRecycleTypeGrid_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName == "delete")
     {
         var a    = Convert.ToInt32(e.CommandArgument);
         var type = new RecycleTypeEntity(a);
         type.IsActive = false;
         type.Save();
     }
 }
Example #2
0
        protected void btnSaveRecycleType_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim().Length > 0)
            {
                RecycleTypeEntity rte = new RecycleTypeEntity();
                rte.Name         = txtName.Text.Trim();
                rte.Description  = txtDescription.Text.Trim().Length > 0 ? txtDescription.Text.Trim() : null;
                rte.SpanishLabel = txtSpanishLabel.Text.Trim().Length > 0 ? txtSpanishLabel.Text.Trim() : null;
                rte.Save();

                txtName.Text         = "";
                txtDescription.Text  = "";
                txtSpanishLabel.Text = "";

                txtName.Focus();
                rdRecycleTypeGrid.Rebind();
            }
        }
Example #3
0
        protected void btnSaveRecycleTypeChanges_Click(object sender, EventArgs e)
        {
            foreach (GridDataItem recycleItem in rdRecycleTypeGrid.Items)
            {
                Hashtable typeValues = new Hashtable();
                recycleItem.ExtractValues(typeValues);
                int recycleTypeId             = Convert.ToInt32(typeValues["RecycleTypeId"].ToString());
                RecycleTypeEntity recycleType = new RecycleTypeEntity(recycleTypeId);

                TextBox txtName = recycleItem.FindControl("txtRecycleTypeName") as TextBox;
                TextBox txtRecycleTypeDescription = recycleItem.FindControl("txtRecycleTypeDescription") as TextBox;
                TextBox txtSpanishLabel           = recycleItem.FindControl("txtSpanishLabel") as TextBox;

                recycleType.Name         = txtName.Text.Trim().Length > 0 ? txtName.Text.Trim() : "";
                recycleType.Description  = txtRecycleTypeDescription.Text.Trim().Length > 0 ? txtRecycleTypeDescription.Text.Trim() : "";
                recycleType.SpanishLabel = txtSpanishLabel.Text.Trim().Length > 0 ? txtSpanishLabel.Text.Trim() : "";

                recycleType.Save();
            }
        }