Exemple #1
0
        protected void GridView_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            switch (e.Parameters)
            {
            case "CloneRow":
                HttpContext.Current.Session["isCloneRow_Com"] = true;
                GridView.JSProperties["cpMessage"]            = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "DetailRow":
                HttpContext.Current.Session["isDetailRow_Com"] = true;
                GridView.JSProperties["cpMessage"]             = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "Actived":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.SetActived(itemID, true);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "InActived":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.SetActived(itemID, false);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "Blocked":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.SetBlocked(itemID, true, User.Identity.Name);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "UnBlocked":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.SetBlocked(itemID, false, User.Identity.Name);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "InActivedBlocked":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.SetActivedBlocked(itemID, false, true, User.Identity.Name);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "ActivedUnBlocked":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.SetActivedBlocked(itemID, true, false, User.Identity.Name);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

            case "Delete":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    StatusProvider.Delete(itemID);
                    //StandardTypeProvider.Delete(itemID);
                    GridView.DataBind();
                    UpdateNavBarName();
                }
                GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                break;

                //case "Delete":
                //List<int> selectedIds = GridView.GetSelectedFieldValues("Id").ConvertAll(id => (int)id);
                //foreach (var item in selectedIds)
                //{
                //    StandardTypeProvider.DeleteSuit(item, false);
                //    HttpContext.Current.Session["isActBloChanged_Com"] = true;
                //}
                //GridView.DataBind();
                //GridView.JSProperties["cpMessage"] = string.Format("OrderDate {0} is later than {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString());
                //break;
            }
            GridView.JSProperties["cpParameters"] = e.Parameters;
        }