void l_CustomProcessSelectedItem(object sender, CustomProcessListViewSelectedItemEventArgs e)
        {
            e.Handled = true;
            var nf = Frame as NestedFrame;

            if (nf != null && nf.ViewItem.CurrentObject is ISuperLookupHelper)
            {
                //var s = nf.ViewItem.CurrentObject as ISuperLookupHelper;
                //s.OnSelected(e.InnerArgs.CurrentObject);

                return;
            }

            if (View is ListView && ((ListView)View).Editor is ASPxGridListEditor)
            {
                return;

                ASPxGridView grid = ((ASPxGridListEditor)((ListView)View).Editor).Grid;
                if (grid != null)
                {
                    int visibleIndex = grid.FindVisibleIndexByKeyValue(View.ObjectSpace.GetKeyValue(e.InnerArgs.CurrentObject));
                    grid.StartEdit(visibleIndex);
                }
            }
        }
Exemple #2
0
        protected void grillaTandaItemAgregados_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            ASPxGridView grilla = (ASPxGridView)sender;
            //int indice = grilla.EditingRowVisibleIndex;

            int       indice                   = grilla.FindVisibleIndexByKeyValue(e.Keys[grilla.KeyFieldName]);
            int       codigoTandaItem          = Convert.ToInt32(grilla.GetRowValues(indice, "codigoTandaItem"));
            DataTable tablaTandaItems          = (DataTable)Session["tablaTandaItemsCrearEntidad"];
            DataTable tablaTandaItemsAgregados = (DataTable)Session["tablaTandaItemsAgregadosCrearEntidad"];

            for (int i = 0; i < tablaTandaItemsAgregados.Rows.Count; i++)
            {
                DataRow fila = tablaTandaItemsAgregados.Rows[i];
                if (Convert.ToInt32(fila["codigoTandaItem"]) == codigoTandaItem)
                {
                    fila["cantidad"] = fila["cantidadTotal"];
                    tablaTandaItems.Rows.Add(fila.ItemArray);
                    tablaTandaItemsAgregados.Rows[i].Delete();
                    grilla.JSProperties["cpHaceCallBack"] = true;
                    break;
                }
            }
            CargarGrillaTandaItems(tablaTandaItems);
            CargarGrillaTandaItemsAgregados(tablaTandaItemsAgregados);
            e.Cancel = true;
        }
Exemple #3
0
    private bool IsFirstRow(ASPxGridViewColumnDataEventArgs e)
    {
        ASPxGridView grid     = e.Column.Grid;
        object       keyValue = e.GetListSourceFieldValue(grid.KeyFieldName);

        return(grid.FindVisibleIndexByKeyValue(keyValue) == 0);
    }
        protected void ASPxGridView1_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e)
        {
            ASPxGridView grid = (ASPxGridView)sender;

            e.Handled = true;

            foreach (var updateValue in e.UpdateValues)
            {
                int    index   = grid.FindVisibleIndexByKeyValue(updateValue.Keys["Seq"]);
                int    seq     = (int)grid.GetRowValues(index, "Seq");
                string emp_nm  = updateValue.NewValues.Contains("Print_emp_nm") ? Convert.ToString(updateValue.NewValues["Print_emp_nm"]) : Convert.ToString(updateValue.OldValues["Print_emp_nm"]);
                string emp_enm = updateValue.NewValues.Contains("Print_emp_enm") ? Convert.ToString(updateValue.NewValues["Print_emp_enm"]) : Convert.ToString(updateValue.OldValues["Print_emp_enm"]);
                string comp_nm = updateValue.NewValues.Contains("Print_comp_nm") ? Convert.ToString(updateValue.NewValues["Print_comp_nm"]) : Convert.ToString(updateValue.OldValues["Print_comp_nm"]);
                string dept_nm = updateValue.NewValues.Contains("Print_dept_nm") ? Convert.ToString(updateValue.NewValues["Print_dept_nm"]) : Convert.ToString(updateValue.OldValues["Print_dept_nm"]);
                string posi_nm = updateValue.NewValues.Contains("Print_posi_nm") ? Convert.ToString(updateValue.NewValues["Print_posi_nm"]) : Convert.ToString(updateValue.OldValues["Print_posi_nm"]);

                using (UnitOfWork uow = XpoHelper.GetNewUnitOfWorkINTF())
                {
                    CriteriaOperator   op  = CriteriaOperator.Parse("Seq=?", seq);
                    CardApprovalEntity Xpo = uow.FindObject <CardApprovalEntity>(op);


                    Xpo.Print_emp_nm  = emp_nm;
                    Xpo.Print_emp_enm = emp_enm;
                    Xpo.Print_comp_nm = comp_nm;
                    Xpo.Print_dept_nm = dept_nm;
                    Xpo.Print_posi_nm = posi_nm;
                    Xpo.Seq           = seq;

                    Xpo.Save();
                    uow.CommitChanges();
                }
            }
        }
Exemple #5
0
    protected void ASPxGridView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
    {
        ASPxGridView grid         = (ASPxGridView)sender;
        int          visibleIndex = grid.FindVisibleIndexByKeyValue(e.GetListSourceFieldValue("ProductID"));

        e.Value = (visibleIndex != 0) ?
                  Convert.ToInt32(grid.GetRowValues(visibleIndex, "UnitsInStock")) + Convert.ToInt32(grid.GetRowValues(visibleIndex - 1, "Total")) :
                  Convert.ToInt32(grid.GetRowValues(visibleIndex, "UnitsInStock"));
    }
Exemple #6
0
 protected void ASPxgvAssessments_DataBound(object sender, EventArgs e)
 {
     if (newKey > -1)
     {
         ASPxGridView g        = sender as ASPxGridView;
         int          rowIndex = g.FindVisibleIndexByKeyValue(newKey);
         g.StartEdit(rowIndex);
     }
 }
        protected void ASPxGridView_Main_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            ASPxGridView gridView = (ASPxGridView)sender;
            int          i        = gridView.FindVisibleIndexByKeyValue(e.Keys[gridView.KeyFieldName]);

            e.Cancel = true;
            dt       = (DataTable)Session["DataTable_CB"];
            dt.Rows.Remove(dt.Rows.Find(e.Keys[gridView.KeyFieldName]));
            //ShowData(gridView, dt);
        }
    //List<String> GetGridViewSeletedRowsText(ASPxGridView gridView) {
    //    List<String> result = new List<string>();
    //    for (int i = 0; i < gridView.VisibleRowCount; i++) {
    //        if(gridView.Selection.IsRowSelectedByKey(gridView.GetRowValues(i, "Value")))
    //            result.Add(gridView.GetRowValues(i, "Text").ToString());
    //    }
    //    return result;
    //}

    void SetGridViewSelectedRows(ASPxGridView gridView, IEnumerable values)
    {
        gridView.Selection.UnselectAll();
        foreach (object value in values)
        {
            if (gridView.FindVisibleIndexByKeyValue(value) >= 0)
            {
                gridView.Selection.SelectRowByKey(value);
            }
        }
    }
Exemple #9
0
    protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
    {
        ASPxGridView grid = sender as ASPxGridView;

        //Switch the grid to edit mode for the last selected row
        if (e.Parameters == "StartEditing")
        {
            object lastSelectedRowKeyValue     = grid.GetSelectedFieldValues("ID")[grid.Selection.Count - 1];
            int    lastSelectedRowVisibleIndex = grid.FindVisibleIndexByKeyValue(lastSelectedRowKeyValue);
            grid.StartEdit(lastSelectedRowVisibleIndex);
        }
    }
    protected void OrderDetailsGridView_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
    {
        if (e.Parameters == "MakeVisible")
        {
            ASPxGridView grid = (ASPxGridView)sender;

            object key          = GetKeyValue();
            int    visibleIndex = grid.FindVisibleIndexByKeyValue(key);

            grid.MakeRowVisible(key);
            grid.ScrollToVisibleIndexOnClient = visibleIndex;
            grid.FocusedRowIndex = visibleIndex;
        }
    }
Exemple #11
0
        protected void SetFocusedRowInGridView(ASPxGridView grid, object sessionName = null)
        {
            int index = 0;

            if (sessionName != null)
            {
                if (SessionHasValue(sessionName))
                {
                    index = grid.FindVisibleIndexByKeyValue(GetIntValueFromSession(sessionName));
                    RemoveSession(sessionName);
                }
            }
            grid.Settings.GridLines           = GridLines.Both;
            grid.FocusedRowIndex              = index;
            grid.ScrollToVisibleIndexOnClient = index;
        }
Exemple #12
0
    protected void gvProducts_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
    {
        ASPxGridView gridView = sender as ASPxGridView;

        string[] parameters = e.Parameters.Split('|');
        string   command    = parameters[0];

        if (command == "MOVEUP" || command == "MOVEDOWN")
        {
            int focusedRowKey = GetGridViewKeyByVisibleIndex(gridView, gridView.FocusedRowIndex);
            int index         = (int)gridView.GetRowValues(gridView.FocusedRowIndex, "DisplayOrder");
            int newIndex      = index;
            if (command == "MOVEUP")
            {
                newIndex = (index == 0) ? index : index - 1;
            }
            if (command == "MOVEDOWN")
            {
                newIndex = (index == gridView.VisibleRowCount) ? index : index + 1;
            }
            int rowKey = GetKeyIDBySortIndex(gridView, newIndex);
            UpdateSortIndex(focusedRowKey, newIndex);
            UpdateSortIndex(rowKey, index);
            gridView.FocusedRowIndex = gridView.FindVisibleIndexByKeyValue(rowKey);
        }
        if (command == "DRAGROW")
        {
            int draggingIndex     = int.Parse(parameters[1]);
            int targetIndex       = int.Parse(parameters[2]);
            int draggingRowKey    = GetKeyIDBySortIndex(gridView, draggingIndex);
            int targetRowKey      = GetKeyIDBySortIndex(gridView, targetIndex);
            int draggingDirection = (targetIndex < draggingIndex) ? 1 : -1;
            for (int rowIndex = 0; rowIndex < gridView.VisibleRowCount; rowIndex++)
            {
                int rowKey = GetGridViewKeyByVisibleIndex(gridView, rowIndex);
                int index  = (int)gridView.GetRowValuesByKeyValue(rowKey, "DisplayOrder");
                if ((index > Math.Min(targetIndex, draggingIndex)) && (index < Math.Max(targetIndex, draggingIndex)))
                {
                    UpdateSortIndex(rowKey, index + draggingDirection);
                }
            }
            UpdateSortIndex(draggingRowKey, targetIndex);
            UpdateSortIndex(targetRowKey, targetIndex + draggingDirection);
        }
        gridView.DataBind();
    }
Exemple #13
0
        protected void grvEmpleados_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            try
            {
                ASPxGridView grid = (sender as ASPxGridView);
                //Switch the grid to edit mode for the last selected row
                if (e.Parameters == "StartEditing")
                {
                    object lastSelectedRowKeyValue     = grid.GetSelectedFieldValues(Constantes.ColumnaInfoAdicUserId)[grid.Selection.Count - 1];
                    int    lastSelectedRowVisibleIndex = grid.FindVisibleIndexByKeyValue(lastSelectedRowKeyValue);
                    grid.StartEdit(lastSelectedRowVisibleIndex);
                }
                else
                {
                    string strKey = "";
                    List <TreeListNode> lstSelectedNodes = trlDepartamentos.GetSelectedNodes();
                    if (lstSelectedNodes.Count > 0)
                    {
                        foreach (TreeListNode Node in lstSelectedNodes)
                        {
                            strKey += Node.Key + ",";
                        }
                        strKey = strKey.Substring(0, strKey.Length - 1);
                        Session["DepartamentoSelected"] = strKey;
                        DataTable dtbEmpleados = (DataTable)Session[Constantes.SessionTblInfoAdicional];
                        String    strFilter    = Constantes.ColumnaInfoAdicUserId + " in (" + strKey + ")";
                        DataRow[] dtrFilter    = dtbEmpleados.Select(strFilter);
                        DataTable dtbFilter    = dtbEmpleados.Clone();

                        foreach (DataRow row in dtrFilter)
                        {
                            dtbFilter.ImportRow(row);
                        }
                        Session[Constantes.SessionTblInfoAdicional1] = dtbFilter;

                        grid.DataSource = dtbFilter;
                        grid.DataBind();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #14
0
        void gridView_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            string[] parameters = e.Parameters.Split('|');

            if (parameters.Length == 2 && (parameters[0] == "up" || parameters[0] == "down"))
            {
                ASPxGridView gridView = (ASPxGridView)sender;
                Object       key      = TypeDescriptor.GetConverter(View.ObjectTypeInfo.KeyMember.MemberType).ConvertFromString(parameters[1]);
                int          rowIndex = gridView.FindVisibleIndexByKeyValue(key);
                if (parameters[0] == "up" && rowIndex > 0)
                {
                    SwitchIndices((DomainObject1)gridView.GetRow(rowIndex), (DomainObject1)gridView.GetRow(rowIndex - 1));
                }
                if (parameters[0] == "down" && rowIndex < gridView.VisibleRowCount - 1)
                {
                    SwitchIndices((DomainObject1)gridView.GetRow(rowIndex), (DomainObject1)gridView.GetRow(rowIndex + 1));
                }
            }
        }
Exemple #15
0
        public void LoadData()
        {
            if (Convert.ToString(Session["Username"]).Equals(String.Empty))
            {
                DangNhap.Visible = true;
            }
            else
            {
                DangNhap.Visible = false;
                listDonVi        = Permission.getAll <TSCD.Entities.DonVi>(Permission._VIEW).OrderBy(c => c.ten).ToList();
                if (listDonVi.Count > 0)
                {
                    infotr.Visible = true;
                    _ucTreeViTri.CreateTreeList();
                    //if (!IsPostBack)
                    //{
                    //    TreeListTextColumn _TreeListTextColumn = new TreeListTextColumn();
                    //    _ucTreeViTri.Label_TenViTri.Text = "Danh sách đơn vị";

                    //    TreeListDataColumn colDonvi = new TreeListDataColumn("ten", "Đơn vị");
                    //    _ucTreeViTri.ASPxTreeList_ViTri.Columns.Add(colDonvi);
                    //    //TreeListDataColumn colloaidonvi = new TreeListDataColumn("loaidonvi.ten", "Loại đơn vị");
                    //    //_ucTreeViTri.ASPxTreeList_ViTri.Columns.Add(colloaidonvi);
                    //}
                    //_ucTreeViTri.ASPxTreeList_ViTri.Settings.ShowColumnHeaders = true;
                    _ucTreeViTri.ASPxTreeList_ViTri.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control;
                    //_ucTreeViTri.ASPxTreeList_ViTri.Width = Unit.Percentage(100);
                    //_ucTreeViTri.ASPxTreeList_ViTri.Settings.GridLines = GridLines.Vertical;
                    //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.Mode = TreeListPagerMode.ShowPager;
                    //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.PageSize = 10;
                    //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.NextPageButton.Visible = false;
                    //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.LastPageButton.Visible = false;

                    //_ucTreeViTri.ASPxTreeList_ViTri.Settings.ShowColumnHeaders = true;
                    _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listDonVi;
                    _ucTreeViTri.ASPxTreeList_ViTri.DataBind();

                    SearchFunction();
                    if (Request.QueryString["key"] != null)
                    {
                        if (Session["DangMo"] != null)
                        {
                            LinkButton_ThuLai.Visible = true;
                            LinkButton_MoRa.Visible   = false;
                            tdvitri.Visible           = true;
                        }
                        else
                        {
                            LinkButton_ThuLai.Visible = false;
                            LinkButton_MoRa.Visible   = true;
                            tdvitri.Visible           = false;
                        }
                        infotd.Visible = true;
                        string key = "";
                        try
                        {
                            key = Request.QueryString["key"].ToString();
                        }
                        catch
                        {
                            Response.Redirect(Request.Url.AbsolutePath);
                        }

                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key);
                        if (node != null)
                        {
                            _ucTreeViTri.FocusAndExpandToNode(node);
                            LoadFocusedNodeData();
                        }
                        else
                        {
                            Response.Redirect(Request.Url.AbsolutePath);
                        }
                        if (Request.QueryString["id"] != null)
                        {
                            string id = "";
                            try
                            {
                                id = Request.QueryString["id"].ToString();
                            }
                            catch
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }
                            int index_id = ASPxGridView.FindVisibleIndexByKeyValue(id);
                            ASPxGridView.Selection.SetSelection(index_id, true);
                            int pagesize = ASPxGridView.SettingsPager.PageSize;
                            ASPxGridView.PageIndex = index_id / pagesize;
                        }
                    }
                    else
                    {
                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                        node.Focus();
                        ChuaChonViTri.Visible             = true;
                        ucWarning_ChuaChon.LabelInfo.Text = "Chưa chọn đơn vị";
                        ClearData();
                    }
                }
                else
                {
                    KhongCoDuLieu.Visible = true;
                    ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có đơn vị";
                }
            }
        }
Exemple #16
0
 protected void FocusThisRowGrid(ASPxGridView grid, int keyVal)
 {
     grid.FocusedRowIndex = grid.FindVisibleIndexByKeyValue(keyVal);
 }
 public static object GetItem(this ASPxGridView source, object keyValue)
 {
     return(source.GetItem(source.FindVisibleIndexByKeyValue(keyValue)));
 }
Exemple #18
0
    public void gridCallBackOption(ASPxGridView grid, string param, string KeyFieldName, SqlDataSource ds)
    {
        try
        {

            HttpCookie myCookie = Request.Cookies[CU.getuserid().ToString()];

            switch (param)
            {
                case "isShowFiltertrue":
                    grid.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
                    if (myCookie != null) myCookie["GroupFilter"] = "true";
                    break;
                case "isShowFilterfalse":
                    grid.Settings.ShowFilterBar = GridViewStatusBarMode.Hidden;
                    if (myCookie != null) myCookie["GroupFilter"] = "false";
                    break;
                case "isShowHScrolltrue":
                    grid.Settings.HorizontalScrollBarMode = DevExpress.Web.ASPxClasses.ScrollBarMode.Visible;
                    if (myCookie != null) myCookie["HScroll"] = "true";
                    break;
                case "isShowHScrollfalse":
                    grid.Settings.HorizontalScrollBarMode = DevExpress.Web.ASPxClasses.ScrollBarMode.Hidden;
                    if (myCookie != null) myCookie["HScroll"] = "false";
                    break;
                case "isShowHypColtrue":
                    grid.AccessibilityCompliant = true;
                    if (myCookie != null) myCookie["HypCol"] = "true";
                    break;
                case "isShowHypColfalse":
                    grid.AccessibilityCompliant = false;
                    if (myCookie != null) myCookie["HypCol"] = "false";
                    break;
                case "isShowGrouptrue":
                    grid.Settings.ShowGroupPanel = true;
                    if (myCookie != null) myCookie["Grouptrue"] = "true";
                    break;
                case "isShowGroupfalse":
                    grid.Settings.ShowGroupPanel = false;
                    if (myCookie != null) myCookie["Grouptrue"] = "false";
                    break;
            }

            List<object> listKeyValueOK = new List<object>();

            if (param.IndexOf("focus") >= 0)
            {
                int id = 0;
                Int32.TryParse(param.Replace("focus", ""), out id);
                if (id > 0)
                    grid.FocusedRowIndex = grid.FindVisibleIndexByKeyValue(param.Replace("focus", ""));
            }
            else if (param.IndexOf("action") >= 0)
            {
                int action = int.Parse(param.Replace("action", ""));

                List<object> listkeyvalue = grid.GetSelectedFieldValues(grid.KeyFieldName);
                SiAuto.Main.LogColored(System.Drawing.Color.Purple, grid.KeyFieldName + "Số dòng :" + listkeyvalue.Count);
                if (listkeyvalue.Count > 0)
                {
                    for (int i = 0; i < listkeyvalue.Count; i++)
                    {
                        SiAuto.Main.LogColored(System.Drawing.Color.Purple, "key so :" + i.ToString() + "----" + listkeyvalue[i]);
                        string currentCode = "isApproved=" + action + " AND " + grid.KeyFieldName + "=" + listkeyvalue[i];
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            var values = new Dictionary<string, object>
                        {
                            {"isApproved",action},
                            {grid.KeyFieldName,listkeyvalue[i]}
                        };

                            EU.updateTblScript(globalModuleID, values);
                            listKeyValueOK.Add(listkeyvalue[i]);
                        }
                    }

                    if (listKeyValueOK.Count > 0)
                    {
                        if (action == 1)
                        {
                            WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "APPROVED", string.Join(";", listKeyValueOK));
                            UserUtils.Log(CU.getLoginID(), globalModuleID, -1, string.Join(";", listKeyValueOK), "", "Duyệt thành công !", "APPROVED");
                        }
                        else
                        {
                            WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "NOTAPPROVED", string.Join(";", listKeyValueOK));
                            UserUtils.Log(CU.getLoginID(), globalModuleID, -1, string.Join(";", listKeyValueOK), "", "Bỏ duyệt thành công !", "NOTAPPROVED");
                        }
                        listKeyValueOK.Clear();
                    }
                }
                else
                {
                    object currentFocused = grid.GetRowValues(grid.FocusedRowIndex, grid.KeyFieldName);
                    string currentCode = "isApproved=" + action + " AND " + grid.KeyFieldName + "=" + currentFocused.ToString();
                    bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                    if (check == true)
                    {
                        if (currentFocused != null)
                        {
                            var values = new Dictionary<string, object>{
                            {"isApproved",action},
                            {grid.KeyFieldName,currentFocused}
                        };
                            EU.updateTblScript(globalModuleID, values);

                            if (action == 1)
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow APPROVED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "APPROVED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow APPROVED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail APPROVED");
                                //UserUtils.Log(CU.getLoginID(), globalModuleID, -1, currentFocused.ToString(), "", "Duyệt thành công !", "APPROVED");
                                SiAuto.Main.LogColored(Color.Green, "end tray ");
                            }
                            else
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow NOTAPPROVED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "NOTAPPROVED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow NOTAPPROVED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail NOTAPPROVED");
                                //UserUtils.Log(CU.getLoginID(), globalModuleID, -1, currentFocused.ToString(), "", "Bỏ duyệt thành công !", "NOTAPPROVED");
                                SiAuto.Main.LogColored(Color.Green, "end tray NOTAPPROVED");
                            }
                        }
                    }
                }
                UserUtils.Log(CU.getLoginID(), globalModuleID, -1, -1, listkeyvalue.ToString(), "", "APPROVED :" + action);
            }

            else if (param.IndexOf("delselect") >= 0)
            {
                List<object> listid = grid.GetSelectedFieldValues(new string[] { grid.KeyFieldName });

                if (listid.Count > 0)
                {
                    for (int i = 0; i < listid.Count; i++)
                    {
                        SiAuto.Main.LogColored(System.Drawing.Color.Purple, "key so :" + i.ToString() + "----" + listid[i]);
                        string currentCode = "isDeleted=1 AND " + grid.KeyFieldName + "=" + listid[i];
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.deleteMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", listid));
                            listKeyValueOK.Add(listid[i]);
                        }
                    }
                    if (listKeyValueOK.Count > 0)
                    {
                        WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "DELETED", string.Join(";", listKeyValueOK));
                        listKeyValueOK.Clear();
                    }
                }
                else
                {
                    object currentFocused = grid.GetRowValues(grid.FocusedRowIndex, grid.KeyFieldName);
                    if (currentFocused != null)
                    {
                        string currentCode = "isDeleted=1 AND " + grid.KeyFieldName + "=" + currentFocused.ToString();
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.deleteMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", currentFocused.ToString()));
                            if (int.Parse(rowDeleted) > 0)
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow DELETED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "DELETED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow DELETED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail DELETED");
                                UserUtils.Log(CU.getLoginID(), globalModuleID, -1, int.Parse(currentFocused.ToString()), "", "Xóa thành công !", "DELETED");
                                SiAuto.Main.LogColored(Color.Green, "end tray DELETED");
                            }

                        }
                    }
                }

            }
            else if (param.IndexOf("RestoreSelect") >= 0)
            {

                List<object> listid = grid.GetSelectedFieldValues(new string[] { grid.KeyFieldName });
                if (listid.Count > 0)
                {
                    for (int i = 0; i < listid.Count; i++)
                    {
                        SiAuto.Main.LogColored(System.Drawing.Color.Purple, "key so :" + i.ToString() + "----" + listid[i]);
                        string currentCode = "isDeleted=0 AND " + grid.KeyFieldName + "=" + listid[i];
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.restoreMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", listid));
                            listKeyValueOK.Add(listid[i]);
                        }
                    }
                    if (listKeyValueOK.Count > 0)
                    {
                        WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "RESTORED", string.Join(";", listKeyValueOK));
                        listKeyValueOK.Clear();
                    }
                }
                else
                {
                    object currentFocused = grid.GetRowValues(grid.FocusedRowIndex, grid.KeyFieldName);
                    if (currentFocused != null)
                    {
                        string currentCode = "isDeleted=0 AND " + grid.KeyFieldName + "=" + currentFocused.ToString();
                        bool check = EU.CheckByModuleD(globalModuleID, currentCode);
                        if (check == true)
                        {
                            string rowDeleted = EU.restoreMultiTblScript(globalModuleID, grid.KeyFieldName, string.Join(",", currentFocused.ToString()));
                            if (int.Parse(rowDeleted) > 0)
                            {
                                SiAuto.Main.LogColored(Color.Green, "Chuan bi workflow RESTORED");
                                WorkFlowManager.BuildTaskByWhenExecute(globalModuleID, "RESTORED", currentFocused.ToString());
                                SiAuto.Main.LogColored(Color.Green, "End workflow RESTORED");

                                SiAuto.Main.LogColored(Color.Green, "ghi vao tray - bảng SY_audit_trail RESTORED");
                                UserUtils.Log(CU.getLoginID(), globalModuleID, -1, int.Parse(currentFocused.ToString()), "", "Phục hồi thành công !", "RESTORED");
                                SiAuto.Main.LogColored(Color.Green, "end tray RESTORED");
                            }
                        }
                    }
                }
            }
            grid.DataBind();
            if (myCookie != null) Response.Cookies.Set(myCookie);
        }
        catch (Exception ex)
        {

            throw new Exception(ex.Message);
        }
    }