Esempio n. 1
0
 protected void gridviewObjectType_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCommandButtonEventArgs e)
 {
     if (e.ButtonType == ColumnCommandButtonType.SelectCheckbox)
     {
         //Determine type of object type custom field
         //Get current object type
         var objectId = gridviewObjectType.GetRowValues(e.VisibleIndex, "ObjectTypeId");
         if (objectId != null)
         {
             NAS.DAL.CMS.ObjectDocument.CustomField customField = GetCurrentCustomField(session);
             if (customField == null)
             {
                 return;
             }
             ObjectType objectType = session.GetObjectByKey <ObjectType>((Guid)objectId);
             //Get ObjectTypeCustomField
             CriteriaOperator criteria = CriteriaOperator.And(
                 new BinaryOperator("ObjectTypeId", objectType),
                 new BinaryOperator("CustomFieldId", customField),
                 CriteriaOperator.Or(
                     new BinaryOperator("CustomFieldType", CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER),
                     new BinaryOperator("CustomFieldType", CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER_READONLY),
                     new BinaryOperator("CustomFieldType", CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_READONLY)
                     )
                 );
             ObjectTypeCustomField objectTypeCustomField =
                 session.FindObject <ObjectTypeCustomField>(criteria);
             if (objectTypeCustomField != null)
             {
                 e.Enabled = false;
             }
         }
     }
 }
Esempio n. 2
0
    //protected void NullValidate(object source, ServerValidateEventArgs arguments)
    //{
    //    var createNumberTimes = Convert.ToInt32((gv_Stone.FindEditFormTemplateControl("txtMultipleCreate") as ASPxTextBox).Value);
    //    RequiredBarcode = checkRequiredNumber();
    //    if (RequiredBarcode == true)
    //    {
    //        //check txtProductNo is empty
    //        if (createNumberTimes == 0 || createNumberTimes == null)
    //        {
    //            arguments.IsValid = false;
    //        }
    //        else
    //        {
    //            arguments.IsValid = true;
    //        }
    //    }
    //    else
    //    {
    //        arguments.IsValid = false;
    //    }

    //}

    //private Boolean checkRequiredNumber()
    //{


    //    int createNumberTimes = 0;
    //    //string ProductBarcode = "";
    //    Boolean rValue = false;

    //    try
    //    {
    //        createNumberTimes = Convert.ToInt32((gv_Stone.FindEditFormTemplateControl("txtMultipleCreate") as ASPxTextBox).Value);
    //        //var str = txtMultipleCreate.Value.ToString();
    //        //ProductBarcode = str.Substring(0, 2);
    //    }
    //    catch (Exception ex)
    //    {
    //        Console.WriteLine("An error occurred: '{0}'", ex);
    //    }


    //    /*
    //     logic to check this product series required barcode
    //     if required
    //        rValue = true;
    //     else
    //        rValue = false;
    //    */
    //    if (createNumberTimes != 0 )
    //    {
    //        rValue = true;
    //    }
    //    else
    //    {
    //        rValue = false;
    //    }
    //    return rValue;


    //}

    protected void gv_Stone_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCommandButtonEventArgs e)
    {
        if (e.Button.ButtonType == DevExpress.Web.ASPxGridView.ColumnCommandButtonType.Edit)
        {
            UserSet myUser = (UserSet)Session["User"];
            if ((myUser.Role != "Administrator") && (myUser.Role != "Power User"))
            {
                e.Visible = false;
            }
        }
        if (e.Button.ButtonType == DevExpress.Web.ASPxGridView.ColumnCommandButtonType.Delete)
        {
            UserSet myUser = (UserSet)Session["User"];
            if ((myUser.Role != "Administrator") && (myUser.Role != "Power User"))
            {
                e.Visible = false;
            }
        }
    }
Esempio n. 3
0
        protected void gvFeatureItemList_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCommandButtonEventArgs e)
        {
            if (e.VisibleIndex == -1)
            {
                return;
            }

            switch (e.ButtonType)
            {
                //Show hide buttons based on user role
                //case ColumnCommandButtonType.New:
                //    e.Visible = SessionHandler.LoggedUser.IsUserAuthorised(Enums.Rights.GeneralManagement_Gaurantee_Add);
                //    break;
                //case ColumnCommandButtonType.Edit:
                //    e.Visible = SessionHandler.LoggedUser.IsUserAuthorised(Enums.Rights.GeneralManagement_Gaurantee_Edit);
                //    break;
                //case ColumnCommandButtonType.Delete:
                //    e.Visible = SessionHandler.LoggedUser.IsUserAuthorised(Enums.Rights.GeneralManagement_Gaurantee_Delete);
                //    break;
            }
        }