Beispiel #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();
                    CompanyProvider.SetActived(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 "InActived":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    CompanyProvider.SetActived(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 "Blocked":
                if (GridView.FocusedRowIndex >= 0)
                {
                    var itemID = GridView.GetRowValues(GridView.FocusedRowIndex, "Id").ToString();
                    CompanyProvider.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();
                    CompanyProvider.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();
                    CompanyProvider.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();
                    CompanyProvider.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();
                    CompanyProvider.Delete(itemID);
                    //CompanyProvider.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)
                //{
                //    CompanyProvider.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;
        }