예제 #1
0
        protected void gvActions_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            ASPxGridView gridview = (ASPxGridView)sender;

            if (e.CellType == GridViewTableCommandCellType.Filter)
            {
                return;
            }
            if (e.VisibleIndex == -1)
            {
                return;
            }
            e.Visible = DevExpress.Utils.DefaultBoolean.False;

            var responsibleLogin = Utils.ConvertToTrimmedString(gridview.GetRowValues(e.VisibleIndex, "responsible_login"));

            var action      = Utils.ConvertToTrimmedString(gridview.GetRowValues(e.VisibleIndex, "action"));
            var plannedTerm = Utils.ConvertToNullableDateTime(gridview.GetRowValues(e.VisibleIndex, "planned_term"));
            var term        = Utils.ConvertToNullableDateTime(gridview.GetRowValues(e.VisibleIndex, "term"));

            if (ActiveUser.IsAuthenticated && responsibleLogin != null)
            {
                var activeUserLogin = (new ActiveUser()).UserName;
                responsibleLogin = responsibleLogin.ToUpper();
                if (e.ButtonID == "btnConfirm")
                {
                    e.Visible = (ActiveUser.IsInRole(AppRoles.AuditorAdmin) || responsibleLogin == activeUserLogin) && term == null && plannedTerm != null && action != null ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                }
                if (e.ButtonID == "btnClear")
                {
                    e.Visible = ActiveUser.IsInRole(AppRoles.AuditorAdmin) ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                }
            }
        }
예제 #2
0
 protected void ASPxGridView_Person_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     //if (e.CellType == GridViewTableCommandCellType.Data && ASPxTreeList_Department2.Nodes.Count == 0 && e.ButtonID.Equals("button_EditPerson"))
     //{
     //    e.Visible = DevExpress.Utils.DefaultBoolean.False;
     //}
 }
예제 #3
0
        protected void gridBookingEntries_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            //Pending
            //ASPxGridView grid = sender as ASPxGridView;
            //if (e.ButtonID.Equals("AllocateTransaction"))
            //{
            //    var transactionId = grid.GetRowValues(e.VisibleIndex, "TransactionId");
            //    if (transactionId == null)
            //        return;

            //    NAS.DAL.Accounting.Journal.Transaction transaction =
            //        session.GetObjectByKey<NAS.DAL.Accounting.Journal.Transaction>(transactionId);

            //    if (transaction == null)
            //        return;

            //    if (transaction.RowStatus.Equals(Utility.Constant.ROWSTATUS_BOOKED_ENTRY))
            //    {
            //        e.Visible = DevExpress.Utils.DefaultBoolean.False;
            //    }
            //    else
            //    {
            //        e.Visible = DevExpress.Utils.DefaultBoolean.Default;
            //    }
            //}
        }
예제 #4
0
 protected void grid_OnCustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     if (grid.GetRowValues(e.VisibleIndex, "TRIGGER_STATE") as string == "PAUSED")
     {
         e.Button.Text = "启用";
     }
 }
        protected virtual void CreateCommandButton(GridViewCommandColumnCustomButton button)
        {
            var eventArgs = new ASPxGridViewCustomButtonEventArgs(button, VisibleIndex, CellType, IsRowEditing);

            Grid.RaiseCustomButtonInitialize_Internal(eventArgs);

            switch (eventArgs.Visible)
            {
            case DefaultBoolean.False:
                return;

            case DefaultBoolean.Default:
                if (button._IsVisible(CellType, IsRowEditing))
                {
                    break;
                }

                return;
            }

            CreateCommandButtonSpacerIfNeeded();

            ControlsContainer.Add(
                new GridViewCommandColumnButtonControl(eventArgs, Grid, Scripts.GetCustomButtonFuncArgs, true)
                );
        }
예제 #6
0
 protected void gridviewGeneralJournal_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     if (GUIContext.State is VoucherLockedBookingdEntries && GUIContext.State != null)
     {
         e.Enabled = false;
     }
 }
예제 #7
0
        public static void gdvEffective_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            ASPxGridView gdv = (ASPxGridView)sender;

            object[] effectivePeriod = (object[])gdv.GetRowValues(e.VisibleIndex, "EffectiveFrom", "EffectiveTo");
            SetGridButton(ref e, (DateTime)effectivePeriod[0], (DateTime)effectivePeriod[1]);
        }
예제 #8
0
        public static void gdvEffectivePeriod_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            ASPxGridView gdv = (ASPxGridView)sender;

            iSabaya.TimeInterval effectivePeriod = (iSabaya.TimeInterval)gdv.GetRowValues(e.VisibleIndex, "EffectivePeriod");
            SetGridButton(ref e, effectivePeriod.EffectiveDate, effectivePeriod.ExpiryDate);
        }
예제 #9
0
    public void ASPxGridView2_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        ASPxGridView grid2 = (ASPxGridView)sender;
        string flag = grid2.GetRowValues(e.VisibleIndex, "CONFIRM_FLAG") as string;

        switch (e.ButtonID)
        {
            case "Treated2":
                if (e.CellType == GridViewTableCommandCellType.Filter) break;
                if (flag != "Y")
                    e.Visible = DefaultBoolean.False;

                if (flag == "Y")
                    e.Visible = DefaultBoolean.True;
                break;
            case "Untreated2":
                if (e.CellType == GridViewTableCommandCellType.Filter) break;
                if (flag != "Y")
                    e.Visible = DefaultBoolean.True;

                if (flag == "Y")
                    e.Visible = DefaultBoolean.False;
                break;


        }
    }
예제 #10
0
        protected void gvPersetujuanSurvey_CustomButtonInitialize1(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            try
            {
                var row = gvPersetujuanSurvey.GetRowValues(e.VisibleIndex, "status").ToString();
                if (string.IsNullOrEmpty(row.ToString()))
                {
                }

                else
                {
                    if (e.ButtonID == "detail")
                    {
                        if (row == "A")
                        {
                            e.Image.Url = "~/content/images/checklist.png";
                            //e.Visible = DevExpress.Utils.DefaultBoolean.False;
                        }
                        else
                        {
                            e.Image.Url = "~/content/images/new.png";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #11
0
        public void ASPxGridView1_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            ASPxGridView grid         = (ASPxGridView)sender;
            string       run_flag     = grid.GetRowValues(e.VisibleIndex, "RUN_FLAG") as string;
            string       item_flag    = grid.GetRowValues(e.VisibleIndex, "ITEM_FLAG") as string;
            string       third_flag   = grid.GetRowValues(e.VisibleIndex, "THIRD_FLAG") as string;
            string       confirm_flag = grid.GetRowValues(e.VisibleIndex, "CONFIRM_FLAG") as string;
            string       sn_flag      = grid.GetRowValues(e.VisibleIndex, "SN_FLAG") as string;

            switch (e.ButtonID)
            {
            case "Confirm":
                if (e.CellType == GridViewTableCommandCellType.Filter)
                {
                    break;
                }
                if (confirm_flag == "Y")
                {
                    e.Enabled = false;
                    e.Visible = DefaultBoolean.False;
                }
                else
                {
                    e.Enabled = true;
                    e.Visible = DefaultBoolean.True;
                    if (sn_flag == "N" || item_flag != "N")
                    {
                        e.Enabled = false;
                    }
                }
                break;

            case "Cancel":
                //if (item_flag == "Y" && confirm_flag == "Y" && run_flag == "Y")
                if (e.CellType == GridViewTableCommandCellType.Filter)
                {
                    break;
                }
                if (confirm_flag == "Y")
                {
                    e.Enabled = true;
                    e.Visible = DefaultBoolean.True;
                    if (item_flag != "N")
                    {
                        e.Enabled = false;
                    }
                }
                else
                {
                    e.Enabled = false;
                    e.Visible = DefaultBoolean.False;
                }
                if (run_flag != "N" || item_flag != "N" || third_flag != "N")     //已库房确认的不能修改删除 已参与三方要料的不能修改删除 计划确认或取消或暂停的不能修改
                {
                    e.Enabled = false;
                }
                break;
            }
        }
 void gdvSecondaryOwners_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     if (e.ButtonID.Contains("btnDelete"))
     {
         e.Image.Url = ResImageURL.Delete;
         e.Text      = "Delete";
     }
 }
예제 #13
0
        public void ASPxGridView1_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            ASPxGridView grid         = (ASPxGridView)sender;
            string       run_flag     = grid.GetRowValues(e.VisibleIndex, "RUN_FLAG") as string;
            string       item_flag    = grid.GetRowValues(e.VisibleIndex, "ITEM_FLAG") as string;
            string       third_flag   = grid.GetRowValues(e.VisibleIndex, "THIRD_FLAG") as string;
            string       confirm_flag = grid.GetRowValues(e.VisibleIndex, "CONFIRM_FLAG") as string;

            string    plancode = grid.GetRowValues(e.VisibleIndex, "PLAN_CODE") as string;
            string    sql1     = "select nvl(online_qty,0) from data_plan where plan_code='" + plancode + "' and rownum=1";
            DataTable dt1      = dc.GetTable(sql1);
            string    isonline = "0";

            if (dt1.Rows.Count > 0)
            {
                isonline = dt1.Rows[0][0].ToString();
            }

            switch (e.ButtonID)
            {
            case "Confirm":
                if (e.CellType == GridViewTableCommandCellType.Filter)
                {
                    break;
                }
                if (run_flag != "Y")
                {
                    e.Enabled = false;
                }
                //if (run_flag != "P")
                //    e.Enabled = true;
                if (run_flag == "Y")
                {
                    e.Enabled = true;
                }
                if (isonline == "0")
                {
                    e.Enabled = false;
                }
                break;

            case "Cancel":
                //if (item_flag == "Y" && confirm_flag == "Y" && run_flag == "Y")
                if (e.CellType == GridViewTableCommandCellType.Filter)
                {
                    break;
                }
                if (run_flag == "P")
                {
                    e.Enabled = true;
                }
                if (run_flag != "P")
                {
                    e.Enabled = false;
                }
                break;
            }
        }
예제 #14
0
        protected void ASPxGridViewAusentismos_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            ASPxGridView grid = (ASPxGridView)sender;

            if (e.ButtonID == "btnDelete" && !grid.IsNewRowEditing && grid.GetRowValues(e.VisibleIndex, "ClaveAusentismo").ToString().Trim() == "V")
            {
                e.Visible = DevExpress.Utils.DefaultBoolean.False;
            }
        }
    protected void grid_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        if (e.ButtonID != "ClearFilter")
        {
            return;
        }

        e.Visible = string.IsNullOrEmpty(grid.FilterExpression)
                        ? DevExpress.Utils.DefaultBoolean.False : e.Visible = DevExpress.Utils.DefaultBoolean.Default;
    }
예제 #16
0
        protected void gridMaterial_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            if (e.VisibleIndex < 0)
            {
                return;
            }
            if (Session["replaceType"].ToString() == "oneReplace")
            {
                //如果bom里有匹配物料替换设定一对一替换的,显示替换按钮
                ASPxGridView grid         = (ASPxGridView)sender;
                string       itemCode     = grid.GetRowValues(e.VisibleIndex, "ITEM_CODE") as string;
                string       newPart      = grid.GetRowValues(e.VisibleIndex, "NEWPART") as string;
                string       locationCode = grid.GetRowValues(e.VisibleIndex, "LOCATION_CODE") as string;

                //已经替换的不显示按钮
                string sql = "select * from sjbomsoth where ljdm1='" + itemCode + "' and ljdm2='" + newPart + "' and jhdm='" + Session["planCode"].ToString()
                             + "' and so='" + Session["so"].ToString() + "'  and gwmc='" + locationCode + "' and gzdd='" + Session["plineCode"].ToString() + "'";
                bool useFlag = dc.GetState(sql);

                if (e.ButtonID == "OneReplace")
                {
                    if (newPart == "" || useFlag == true)
                    {
                        e.Visible = DefaultBoolean.False;
                    }
                }
                if (e.ButtonID == "MultiReplace")
                {
                    e.Visible = DefaultBoolean.False;
                }
            }

            //显示多对多替换按钮
            if (Session["replaceType"].ToString() == "multiReplace")
            {
                //如果bom里有匹配物料替换设定一对一替换的,显示替换按钮
                ASPxGridView grid     = (ASPxGridView)sender;
                string       comment1 = grid.GetRowValues(e.VisibleIndex, "COMMENT1") as string;
                if (e.ButtonID == "MultiReplace")
                {
                    if (comment1 == "多重替换")
                    {
                        e.Visible = DefaultBoolean.True;
                    }
                    else
                    {
                        e.Visible = DefaultBoolean.False;
                    }
                }
                if (e.ButtonID == "OneReplace")
                {
                    e.Visible = DefaultBoolean.False;
                }
            }
        }
예제 #17
0
    protected void gridLabEditing_OnCustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        var x = 0;


        ASPxGridView grid = (ASPxGridView)sender;
        //string prefix = GetPrefix(grid);

        string matching_btnID = e.ButtonID;
        int    idx            = Convert.ToInt32(matching_btnID.Replace("grp", ""));



        string abbrids_csv     = grid.GetRowValues(e.VisibleIndex, "abbrids").ToString();
        string lab_abbrids_csv = grid.GetRowValues(e.VisibleIndex, "lab_abbrids").ToString();

        List <string> abbrids     = new List <string>();
        List <string> lab_abbrids = new List <string>();


        //Create the lists
        if (abbrids_csv != "")
        {
            abbrids = abbrids_csv.Split(',').ToList();
        }
        if (lab_abbrids_csv != "")
        {
            lab_abbrids = lab_abbrids_csv.Split(',').ToList();
        }

        if (idx < abbrids.Count)
        {
            string this_abbrid = abbrids[idx];

            List <string> abbrid = this_abbrid.Split('|').ToList();

            e.Text = abbrid[0];

            if (lab_abbrids.Contains(this_abbrid))
            {
                e.Styles.Style.Font.Bold = true;
                e.Styles.Style.ForeColor = Color.Green;
            }
            else
            {
                e.Styles.Style.ForeColor = Color.LightGray;
            }
        }
        else
        {
            e.Enabled = false;
            e.Visible = DevExpress.Utils.DefaultBoolean.False;
        }
    }
예제 #18
0
 protected void gvPenerimaanProposal_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     //if (e.ButtonID == "Detail")
     //{
     //    string status = gvPenerimaanProposal.GetRowValues(e.VisibleIndex, "status").ToString();
     //    if (status != "DALAM PROSES")
     //    {
     //        e.Visible=DevExpress.Utils.DefaultBoolean.False;
     //    }
     //}
 }
예제 #19
0
    protected void grid_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        ASPxGridView grid = (ASPxGridView)sender;

        int n = Convert.ToInt32(grid.GetRowValues(e.VisibleIndex, "n_flds").ToString());

        if (n > 0)
        {
            e.Visible = DevExpress.Utils.DefaultBoolean.False;
        }
    }
예제 #20
0
    public void ASPxGridView1_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        ASPxGridView grid = (ASPxGridView)sender;
        //string sql="select * from DATA_SN_DETECT_DATA_TEMP where "
        //string flag = grid.GetRowValues(e.VisibleIndex, "DETECT_FLAG") as string;
        string flag = "Y";

        if (txtFlag.Text.Trim() != "")
        {
            if (txtFlag.Value.ToString() == "N")
            {
                flag = "N";
            }
            else
            {
                flag = "Y";
            }
        }
        switch (e.ButtonID)
        {
        case "Treated":
            if (e.CellType == GridViewTableCommandCellType.Filter)
            {
                break;
            }
            if (flag != "Y")
            {
                e.Visible = DefaultBoolean.False;
            }

            if (flag == "Y")
            {
                e.Visible = DefaultBoolean.True;
            }

            break;

        case "Untreated":
            if (e.CellType == GridViewTableCommandCellType.Filter)
            {
                break;
            }
            if (flag != "Y")
            {
                e.Visible = DefaultBoolean.True;
            }
            if (flag == "Y")
            {
                e.Visible = DefaultBoolean.False;
            }
            break;
        }
    }
예제 #21
0
        protected void BusinessrGridView_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            if (e.VisibleIndex == -1)
            {
                return;
            }

            if (e.ButtonID == "deleteButton")
            {
                e.Visible = DeleteButtonVisibleCriteria((ASPxGridView)sender, e.VisibleIndex);
            }
        }
예제 #22
0
    protected void ASPxGridView1_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        if (e.VisibleIndex == -1)
        {
            return;
        }

        if (e.ButtonID == "btnCustom" && e.VisibleIndex % 2 != 0)
        {
            e.Visible = DefaultBoolean.False;
        }
    }
예제 #23
0
    public void ASPxGridView2_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        ASPxGridView grid = (ASPxGridView)sender;

        string flag = "Y";

        if (txtFlag.Text.Trim() != "")
        {
            if (txtFlag.Value.ToString() == "N")
            {
                flag = "N";
            }
            else
            {
                flag = "Y";
            }
        }
        switch (e.ButtonID)
        {
        case "Treated2":
            if (e.CellType == GridViewTableCommandCellType.Filter)
            {
                break;
            }
            if (flag != "Y")
            {
                e.Visible = DefaultBoolean.False;
            }

            if (flag == "Y")
            {
                e.Visible = DefaultBoolean.True;
            }

            break;

        case "Untreated2":
            if (e.CellType == GridViewTableCommandCellType.Filter)
            {
                break;
            }
            if (flag != "Y")
            {
                e.Visible = DefaultBoolean.True;
            }
            if (flag == "Y")
            {
                e.Visible = DefaultBoolean.False;
            }
            break;
        }
    }
예제 #24
0
        private static void SetGridButton(ref ASPxGridViewCustomButtonEventArgs e, DateTime from, DateTime to)
        {
            if (to >= DateTime.Now) // Effective now and future
            {
                if (e.ButtonID.Contains("btnExpire"))
                {
                    e.Visible   = DevExpress.Utils.DefaultBoolean.True;
                    e.Image.Url = ResImageURL.Expire;
                    if (string.IsNullOrEmpty(e.Text))
                    {
                        e.Text = ResGeneral.Expire;
                    }
                }
                else if (e.ButtonID.Contains("btnEdit"))
                {
                    e.Visible   = DevExpress.Utils.DefaultBoolean.True;
                    e.Image.Url = ResImageURL.Edit;
                    if (string.IsNullOrEmpty(e.Text))
                    {
                        e.Text = ResGeneral.Edit;
                    }
                }

                else if (e.ButtonID.Contains("btnPerson"))
                {
                    e.Visible   = DevExpress.Utils.DefaultBoolean.True;
                    e.Image.Url = "~/Images/led_icon/employee_account.png";
                    if (string.IsNullOrEmpty(e.Text))
                    {
                        e.Text = ResGeneral.Edit;
                    }
                }
            }
            else
            {
                if (e.ButtonID.Contains("btnExpire"))
                {
                    e.Visible = DevExpress.Utils.DefaultBoolean.False;
                }
                else if (e.ButtonID.Contains("btnEdit"))
                {
                    e.Visible = DevExpress.Utils.DefaultBoolean.False;
                }

                else if (e.ButtonID.Contains("btnPerson"))
                {
                    e.Visible = DevExpress.Utils.DefaultBoolean.False;
                }
            }
        }
    //end button state

    /// <summary>
    /// hide/show custom buttons for internal user
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdTarget_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        Int32 _cid = Page.Session["user"] != null ? (Int32)((UserClass)Page.Session["user"]).CompanyId : 0;

        if (_cid != -1)
        {
            //200812 this is not relevant as we had to put the detailed form on a seperate page
            //detailed edit button, external users get the standard form with restricted details not the whole lot
            if (e.ButtonID == "cmdEdit")
            {
                e.Visible = DevExpress.Utils.DefaultBoolean.False;
            }
        }
    }
예제 #26
0
        protected void UiVistaClientesNuevos_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            try
            {
                if (Session["UiListaClientesNuevos"] == null)
                {
                    return;
                }

                if (e.VisibleIndex >= 0 && ((IList <Cliente>)Session["UiListaClientesNuevos"]).Count != 0)
                {
                    switch (e.ButtonID)
                    {
                    case "Aceptar":
                        if (UiVistaClientesNuevos.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Aceptado) ||
                            UiVistaClientesNuevos.GetRowValues(e.VisibleIndex, "IS_POSTED_ERP").ToString() !=
                            Enums.GetStringValue(ScoutingEnviadoErp.Pendiente))
                        {
                            //PopupScoutingAceptado.ShowOnPageLoad = true;

                            e.Visible = DefaultBoolean.False;
                        }
                        break;

                    case "Rechazar":
                        if (UiVistaClientesNuevos.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Aceptado) ||
                            UiVistaClientesNuevos.GetRowValues(e.VisibleIndex, "IS_POSTED_ERP").ToString() !=
                            Enums.GetStringValue(ScoutingEnviadoErp.Pendiente))
                        {
                            e.Visible = DefaultBoolean.False;
                        }
                        if (UiVistaClientesNuevos.GetRowValues(e.VisibleIndex, "STATUS").ToString() ==
                            Enums.GetStringValue(ScoutingEstado.Rechazado) ||
                            UiVistaClientesNuevos.GetRowValues(e.VisibleIndex, "IS_POSTED_ERP").ToString() !=
                            Enums.GetStringValue(ScoutingEnviadoErp.Pendiente))
                        {
                            e.Visible = DefaultBoolean.False;
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                EstablecerError(ex.Message, UiVistaClientesNuevos);
            }
        }
예제 #27
0
    protected void gv_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        ASPxGridView grid = sender as ASPxGridView;

        if (e.ButtonID == "btnDel" | e.ButtonID == "btnDel2")
        {
            int rows_of_valid_data = Convert.ToInt32(grid.GetRowValues(e.VisibleIndex, "rows_of_valid_data"));
            e.Enabled = (rows_of_valid_data > 0) ? false : true;
        }
        else if (e.ButtonID == "btnZip" | e.ButtonID == "btnZip2")
        {
            string fileext = grid.GetRowValues(e.VisibleIndex, "fileext").ToString();
            e.Enabled = (fileext == ".zip") ? false : false;
        }
    }
예제 #28
0
 private static void SetGridButton(ref ASPxGridViewCustomButtonEventArgs e, iSabaya.TimeInterval effectivePeriod)
 {
     if ((effectivePeriod.EffectiveDate <= DateTime.Now && effectivePeriod.ExpiryDate >= DateTime.Now))
     {
         if (e.ButtonID.Contains("btnEdit"))
         {
             e.Visible   = DevExpress.Utils.DefaultBoolean.True;
             e.Image.Url = ResImageURL.Edit;
             if (string.IsNullOrEmpty(e.Text))
             {
                 e.Text = ResGeneral.Edit;
             }
         }
         else if (e.ButtonID.Contains("btnExpire"))
         {
             e.Visible   = DevExpress.Utils.DefaultBoolean.True;
             e.Image.Url = ResImageURL.Expire;
             if (string.IsNullOrEmpty(e.Text))
             {
                 e.Text = ResGeneral.Expire;
             }
         }
         else if (e.ButtonID.Contains("btnPerson"))
         {
             e.Visible   = DevExpress.Utils.DefaultBoolean.True;
             e.Image.Url = "~/Images/led_icon/employee_account.png";
             if (string.IsNullOrEmpty(e.Text))
             {
                 e.Text = ResGeneral.Edit;
             }
         }
     }
     else
     {
         if (e.ButtonID.Contains("btnEdit"))
         {
             e.Visible = DevExpress.Utils.DefaultBoolean.False;
         }
         else if (e.ButtonID.Contains("btnExpire"))
         {
             e.Visible = DevExpress.Utils.DefaultBoolean.False;
         }
         else if (e.ButtonID.Contains("btnPerson"))
         {
             e.Visible = DevExpress.Utils.DefaultBoolean.False;
         }
     }
 }
예제 #29
0
        //protected void dgRequerimientoDetalle_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridViewCommandButtonEventArgs e)
        //{
        //    UnidadDeTrabajo wu = new UnidadDeTrabajo();

        //    int?[] estateBad = { 27, 28 };
        //    if (NumeroRequerimiento != null && NumeroRequerimiento != "Nuevo")
        //    {
        //        NumeroRequerimiento = Request.QueryString["Id"];
        //        if (e.ButtonType == DevExpress.Web.ColumnCommandButtonType.Update && estateBad.Contains(wu.Requerimiento.ObtenerEstadoRequerimiento(int.Parse(NumeroRequerimiento))))
        //            e.Visible = false;
        //    }
        //}

        protected void dgRequerimientos_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            if (e.ButtonID == "Anular")
            {
                using (var ut = new UnidadDeTrabajo())
                {
                    if (Session["IdUserActive"] != null)
                    {
                        if (ut.ComprobarSoloLectura(int.Parse(Session["IdUserActive"].ToString()), 13) == true)
                        {
                            e.Visible = DevExpress.Utils.DefaultBoolean.False;
                        }
                    }
                }
            }
        }
예제 #30
0
        protected void gvBaganAkun_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
        {
            if (e.VisibleIndex >= 0)
            {
                object[] x = (object[])gvBaganAkun.GetRowValues(e.VisibleIndex, "SaldoAwal", "Debet", "Kredit", "SaldoAkhir", "isTransaksi");

                if (Convert.ToDecimal(x[0]) != 0 || Convert.ToDecimal(x[1]) != 0 || Convert.ToDecimal(x[2]) != 0 || Convert.ToDecimal(x[3]) != 0 || Convert.ToDecimal(x[4]) == 1)
                {
                    e.Visible = DevExpress.Utils.DefaultBoolean.True;
                }
                else
                {
                    e.Visible = DevExpress.Utils.DefaultBoolean.False;
                }
            }
        }
 protected void ASPxGridViewAnexar_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     if (ExibirBotao((ASPxGridView)sender, e.VisibleIndex))
     {
         e.Visible = DefaultBoolean.True;
     }
     else
     {
         e.Visible = DefaultBoolean.False;
     }
 }
    //end button state

    /// <summary>
    /// hide/show custom buttons for internal user
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdorders_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
    {
        Int32 _cid = Page.Session["user"] != null ? (Int32)((UserClass)Page.Session["user"]).CompanyId : 0;
        if (_cid != -1)
        {
            //200812 this is not relevant as we had to put the detailed form on a seperate page
            //detailed edit button, external users get the standard form with restricted details not the whole lot
            if (e.ButtonID == "cmdEdit") { e.Visible = DevExpress.Utils.DefaultBoolean.False; } 
        }
    }
예제 #33
0
 /// <summary>
 /// Hien thi/An nut delete o tung dong
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void gridRoster_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     try
     {
         // Neu la button delete thi kiem tra dieu kien de hien thi
         if (e.CellType == GridViewTableCommandCellType.Data && e.ButtonID == "btnDelete")
         {
             var grid = (ASPxGridView)sender;
             var roster = grid.GetRow(e.VisibleIndex) as Roster;
             if (roster != null && roster.StartTime > DateTime.Now)
             {
                 e.Visible = DefaultBoolean.True;
             }
             else
             {
                 e.Visible = DefaultBoolean.False;
             }
         }
     }
     catch (Exception ex)
     {
         LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
     }
 }
예제 #34
0
 internal void RaiseCustomButtonInitialize_Internal(ASPxGridViewCustomButtonEventArgs e)
 {
     RaiseCustomButtonInitialize(e);
 }
 protected virtual void CreateCommandButton(GridViewCommandColumnCustomButton button)
 {
     var eventArgs = new ASPxGridViewCustomButtonEventArgs(button, VisibleIndex, CellType, IsRowEditing);
     
     Grid.RaiseCustomButtonInitialize_Internal(eventArgs);
     
     switch (eventArgs.Visible)
     {
         case DefaultBoolean.False:
             return;
         case DefaultBoolean.Default:
             if (button._IsVisible(CellType, IsRowEditing))
             {
                 break;
             }
             
             return;
     }
     
     CreateCommandButtonSpacerIfNeeded();
     
     ControlsContainer.Add(
         new GridViewCommandColumnButtonControl(eventArgs, Grid, Scripts.GetCustomButtonFuncArgs, true)
     );
 }
예제 #36
0
 protected void grid_OnCustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)
 {
     if (grid.GetRowValues(e.VisibleIndex, "TRIGGER_STATE") as string == "PAUSED")
         e.Button.Text = "启用";
 }