예제 #1
0
        protected void uploader_FileUploadComplete(object sender, FileUploadCompleteEventArgs e)
        {
            string virtualPath = CommonConstants.STANDARD_PATH;
            string filePath    = "";

            ASPxUploadControl uc = (ASPxUploadControl)sender;
            GridViewEditItemTemplateContainer container = uc.NamingContainer as GridViewEditItemTemplateContainer;

            if (container != null)
            {
                filePath = Page.MapPath(virtualPath);
                //// Kiem tra Folder tao Folder neu chua co
                if (!Directory.Exists(filePath)) // TODO: needs to be created ONLY from setup phase with Security Permissions
                {
                    Directory.CreateDirectory(filePath);
                }

                // process a file
                var name = e.UploadedFile.FileName;
                e.UploadedFile.SaveAs(Page.MapPath(virtualPath + name));

                //ASPxPageControl pageControl = GridView.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
                //ASPxMemo memo = pageControl.FindControl("notesEditor") as ASPxMemo;
                //memo.Text;

                e.CallbackData = virtualPath + name;
            }
            else
            {
            }
        }
예제 #2
0
        protected void POUOM_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource     = MRPClass.UOMTable();
            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "SYMBOL";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "description";
            combo.Columns.Add(l_text);

            combo.ValueField = "SYMBOL";
            combo.TextField  = "description";
            combo.DataBind();
            combo.TextFormatString = "{0}";

            GridViewEditItemTemplateContainer container = ((ASPxComboBox)sender).NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "POUOM").ToString();
            }
        }
    protected void re_Init(object sender, EventArgs e)
    {
        ASPxRichEdit richEdit = sender as ASPxRichEdit;
        GridViewEditItemTemplateContainer container = richEdit.NamingContainer as GridViewEditItemTemplateContainer;

        string documentID = GetDocumentID(container.Grid);

        if (!OpenedCanceledDocumentIDs.Contains(documentID))
        {
            OpenedCanceledDocumentIDs.Add(documentID);
        }

        if (container.Grid.IsNewRowEditing)
        {
            richEdit.DocumentId = documentID;
            return;
        }

        //for text in db
        string rtfText = container.Grid.GetRowValues(container.VisibleIndex, "RtfContent").ToString();

        //for binary in db
        //byte[] rtfBinary = (byte[])container.Grid.GetRowValues(container.VisibleIndex, "RtfContent");

        richEdit.Open(documentID, DocumentFormat.Rtf, () => {
            //for text in db
            return(Encoding.UTF8.GetBytes(rtfText));

            //for binary in db
            //return rtfBinary;
        });
    }
        protected void Code_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource = POClass.PO_EntityCode_Table();

            ListBoxColumn lv = new ListBoxColumn();

            lv.FieldName = "ID";
            lv.Caption   = "Code";
            lv.Width     = 50;
            combo.Columns.Add(lv);

            ListBoxColumn lt = new ListBoxColumn();

            lt.FieldName = "NAME";
            lt.Caption   = "Entity";
            lt.Width     = 250;
            combo.Columns.Add(lt);

            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            combo.ValueField     = "ID";
            combo.TextField      = "NAME";
            combo.DataBind();

            GridViewEditItemTemplateContainer container = ((ASPxComboBox)sender).NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "Code").ToString();
                combo.Text  = DataBinder.Eval(container.DataItem, "Code").ToString();
            }
        }
    protected void cblSuppliers_DataBound(object sender, EventArgs e)
    {
        ASPxCheckBoxList cbl = sender as ASPxCheckBoxList;
        GridViewEditItemTemplateContainer container = cbl.NamingContainer as GridViewEditItemTemplateContainer;

        object ean13Value = DataBinder.Eval(container.DataItem, "EAN13");
        string ean13      = (ean13Value == null) ? String.Empty : ean13Value.ToString();

        string[] idString   = ean13.Split(',');
        int[]    supplierID = new int[idString.Length];

        for (int i = 0; i < idString.Length; i++)
        {
            if (!int.TryParse(idString[i], out supplierID[i]))
            {
                return;
            }
        }

        foreach (ListEditItem Item in cbl.Items)
        {
            if (supplierID.Contains <int>((int)Item.Value))
            {
                Item.Selected = true;
            }
        }
    }
예제 #6
0
    protected void CityCmb_Init(object sender, EventArgs e)
    {
        ASPxComboBox cityCombo = sender as ASPxComboBox;
        GridViewEditItemTemplateContainer container = cityCombo.NamingContainer as GridViewEditItemTemplateContainer;
        int countryID = Convert.ToInt32(container.Grid.GetRowValues(container.Grid.VisibleStartIndex, "CountryID"));

        grid.JSProperties["cplastCountryID"] = countryID;
        cityCombo.DataSource = DataProvider.GetCities(countryID);
    }
예제 #7
0
 protected void UpdateButton_Init(object sender, EventArgs e)
 {
     if (bool.Parse(HttpContext.Current.Session["isDetailRow_Com"].ToString()))
     {
         ASPxButton editor = sender as ASPxButton;
         GridViewEditItemTemplateContainer container = editor.NamingContainer as GridViewEditItemTemplateContainer;
         //editor.ClientVisible = container.Grid.IsNewRowEditing; // or use the Visible property
         editor.ClientEnabled = container.Grid.IsNewRowEditing;
     }
 }
예제 #8
0
        public void InstantiateIn(Control container)
        {
            LiteralControl lc = new LiteralControl();

            lc.ID = "label";
            GridViewEditItemTemplateContainer templateContainer = container as GridViewEditItemTemplateContainer;

            lc.Text = templateContainer.Text;
            container.Controls.Add(lc);
        }
예제 #9
0
    protected void tb_Init(object sender, EventArgs e)
    {
        ASPxTextBox tb = sender as ASPxTextBox;
        GridViewEditItemTemplateContainer container = tb.NamingContainer as GridViewEditItemTemplateContainer;

        tb.ClientInstanceName = "tb" + container.VisibleIndex;
        string text = container.Grid.GetRowValues(container.Grid.EditingRowVisibleIndex, "Description").ToString();

        tb.ClientSideEvents.GotFocus = String.Format("function(s, e) {{ OnGotFocus(s, e, '{0}', '{1}') }}", container.VisibleIndex, text);
    }
    public void InstantiateIn(Control _container)
    {
        GridViewEditItemTemplateContainer container = _container as GridViewEditItemTemplateContainer;

        ASPxLabel lbl = new ASPxLabel();

        lbl.ID = "lbl";

        container.Controls.Add(lbl);
        lbl.Text = container.Text;
    }
예제 #11
0
            public void InstantiateIn(Control _container)
            {
                GridViewEditItemTemplateContainer container = _container as GridViewEditItemTemplateContainer;

                ASPxLabel lbl = new ASPxLabel();

                lbl.ID = "lbl";

                container.Controls.Add(lbl);
                lbl.Text = string.IsNullOrEmpty(container.Text) ? "_" : container.Text;
            }
예제 #12
0
    protected void List_DataBound(object sender, EventArgs e)
    {
        CheckBoxList list = (CheckBoxList)sender;
        GridViewEditItemTemplateContainer container = (GridViewEditItemTemplateContainer)list.Parent;
        IDictionary hash = CreatePersonCategoriesHash(container.Grid.GetRowValues(container.VisibleIndex, "CategoriesString").ToString());

        foreach (ListItem item in list.Items)
        {
            item.Selected = hash.Contains(item.Value);
        }
    }
예제 #13
0
        public void InstantiateIn(Control _container)
        {
            GridViewEditItemTemplateContainer container = _container as GridViewEditItemTemplateContainer;

            object[] values    = (object[])container.Grid.GetRowValues(container.VisibleIndex, new string[] { "Type", "DataValue" });
            string   dataType  = Convert.ToString(values[0]);
            string   dataValue = Convert.ToString(values[1]);

            switch (dataType)
            {
            case "Text":
                ASPxTextBox txt = new ASPxTextBox();
                txt.ID   = "txt";
                txt.Text = dataValue;
                container.Controls.Add(txt);
                break;

            case "DateTime":
                ASPxDateEdit date = new ASPxDateEdit();
                date.ID   = "date";
                date.Date = Convert.ToDateTime(dataValue);
                container.Controls.Add(date);
                break;

            case "Dictionary1":
                ASPxComboBox cmb = new ASPxComboBox();
                cmb.ID         = "dict";
                cmb.DataSource = DataProvider.GetDictionaryData(DataType.Dictionary1);
                cmb.TextField  = "Data";
                cmb.ValueField = "Id";
                cmb.DataBind();
                cmb.Value = dataValue;
                container.Controls.Add(cmb);
                break;

            case "Dictionary2":
                ASPxComboBox cmb2 = new ASPxComboBox();
                cmb2.ID         = "dict";
                cmb2.DataSource = DataProvider.GetDictionaryData(DataType.Dictionary2);
                cmb2.TextField  = "Data";
                cmb2.ValueField = "Id";
                cmb2.DataBind();
                cmb2.Value = dataValue;
                container.Controls.Add(cmb2);
                break;
            }
        }
    protected void img_Init(object sender, EventArgs e)
    {
        ASPxImage img = sender as ASPxImage;
        GridViewEditItemTemplateContainer container = img.NamingContainer as GridViewEditItemTemplateContainer;

        Object value = DataBinder.Eval(container.DataItem, container.Column.FieldName);

        Boolean?b = null;

        if (value != null)
        {
            b = Convert.ToBoolean(value);
        }

        img.JSProperties["cpIndex"] = b.ToInt32();
        img.CssClass = CheckBoxSpriteStyles[b.ToInt32()];

        img.ImageUrl = DevExpress.Web.ASPxClasses.EmptyImageProperties.GetGlobalEmptyImage(Page).Url;
    }
        private void UpdateMasterAccountActorComboBox(object sender)
        {
            ASPxCallbackPanel panel = sender as ASPxCallbackPanel;
            GridViewEditItemTemplateContainer itemContainer = (GridViewEditItemTemplateContainer)panel.NamingContainer;
            ASPxGridView grid = itemContainer.Grid;
            //Get allocation
            ASPxComboBox allocationComboBox =
                (ASPxComboBox)grid.FindEditRowCellTemplateControl(grid.Columns["Allocation!Key"] as GridViewDataColumn, "cboAllocation");

            if (allocationComboBox.Value == null)
            {
                return;
            }
            Guid       allocationId = (Guid)allocationComboBox.Value;
            Allocation allocation   = session.GetObjectByKey <Allocation>(allocationId);
            //Get account actor type
            AllocationAccountActorType masterAllocationAccountActorType =
                allocation.AllocationAccountActorTypes.FirstOrDefault(r => r.IsMaster);

            if (masterAllocationAccountActorType == null)
            {
                throw new Exception("Invalid allocation. Make sure that the allocation has a master account actor type.");
            }
            AccountActorType accountActorType = masterAllocationAccountActorType.AccountActorTypeId;

            AccountActorTypeEnum accountActorTypeEnum =
                (AccountActorTypeEnum)Enum.Parse(typeof(AccountActorTypeEnum), accountActorType.Code);
            //Get account actor combobox
            AccountActorComboBox accountActorComboBox =
                (AccountActorComboBox)panel.FindControl("accountActorComboBox"); //FindEditRowCellTemplateControl(grid.Columns["MasterAccountActor"] as GridViewDataColumn, "accountActorComboBox");

            //Validation setting
            accountActorComboBox.ComboBox.ValidationSettings.ErrorDisplayMode         = ErrorDisplayMode.ImageWithTooltip;
            accountActorComboBox.ComboBox.ValidationSettings.RequiredField.IsRequired = true;
            accountActorComboBox.ComboBox.ValidationSettings.RequiredField.ErrorText  =
                (string)HttpContext.GetGlobalResourceObject("MessageResource", "Msg_Required_Select");
            //Set account actor combobox strategy
            accountActorComboBox.SetAccountActorComboBoxStrategy(
                AccountActorComboBoxStrategyCreators.GetCreator(accountActorTypeEnum).Create());
        }
예제 #16
0
        protected void TaxItemGroup_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = (ASPxComboBox)sender;

            combo.DataSource = POClass.TaxItemGroupTable();

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "TaxItemGroup";
            combo.Columns.Add(l_value);

            combo.ValueField = "TaxItemGroup";
            combo.TextField  = "TaxItemGroup";
            combo.DataBind();

            GridViewEditItemTemplateContainer container = combo.NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "TaxItemGroup").ToString();
            }
        }
    protected void List_DataBound(object sender, EventArgs e)
    {
        CheckBoxList list = (CheckBoxList)sender;
        GridViewEditItemTemplateContainer container = (GridViewEditItemTemplateContainer)list.Parent;

        if (container.Grid.IsNewRowEditing)
        {
            return;
        }

        object values = container.Grid.GetRowValues(container.VisibleIndex, "Categories");

        if (values == null || values == DBNull.Value)
        {
            return;
        }

        string categories = (string)values;

        if (categories == null)
        {
            return;
        }

        string[] categoriesArray = categories.Split(new string[] { CategorySeparator }, StringSplitOptions.None);
        foreach (ListItem item in list.Items)
        {
            item.Selected = false;
            foreach (string category in categoriesArray)
            {
                if (category.Equals(item.Value))
                {
                    item.Selected = true;
                }
            }
        }
    }
예제 #18
0
        public void InstantiateIn(Control container)
        {
            GridViewEditItemTemplateContainer gridContainer = (GridViewEditItemTemplateContainer)container;

            ASPxComboBox comboBox = new ASPxComboBox();

            comboBox.Width = Unit.Percentage(100);
            comboBox.ClientInstanceName       = "ReferencedEdit";
            comboBox.ClientSideEvents.KeyDown = BatchEditKeyDown;

            comboBox.ClientSideEvents.LostFocus = BatchEditLostFocus;

            ListEditItem notAssignedItem = new ListEditItem("N/A", null);

            comboBox.Items.Add(notAssignedItem);

            foreach (var currentObject in Objects)
            {
                ListEditItem item = new ListEditItem(currentObject.Name, currentObject.Oid);
                comboBox.Items.Add(item);
            }

            container.Controls.Add(comboBox);
        }
예제 #19
0
        protected void itemcode_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource = MRPClass.PO_ItemCodes(docnumber);

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "ItemCode";
            l_value.Caption   = "Item Code";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text_1 = new ListBoxColumn();

            l_text_1.FieldName = "Description";
            combo.Columns.Add(l_text_1);

            ListBoxColumn l_text_2 = new ListBoxColumn();

            l_text_2.FieldName = "UOM";
            combo.Columns.Add(l_text_2);

            ListBoxColumn l_text_3 = new ListBoxColumn();

            l_text_3.FieldName = "Cost";
            combo.Columns.Add(l_text_3);

            ListBoxColumn l_text_4 = new ListBoxColumn();

            l_text_4.FieldName = "Qty";
            combo.Columns.Add(l_text_4);

            ListBoxColumn l_text_5 = new ListBoxColumn();

            l_text_5.FieldName = "TotalCost";
            combo.Columns.Add(l_text_5);

            ListBoxColumn l_text_6 = new ListBoxColumn();

            l_text_6.FieldName = "Type";
            combo.Columns.Add(l_text_6);

            ListBoxColumn l_text_pk = new ListBoxColumn();

            l_text_pk.FieldName = "PK";
            l_text_pk.Width     = 0;
            combo.Columns.Add(l_text_pk);

            ListBoxColumn l_text_identifier = new ListBoxColumn();

            l_text_identifier.FieldName = "Identifier";
            l_text_identifier.Width     = 0;
            combo.Columns.Add(l_text_identifier);

            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            combo.TextField      = "ItemCode";
            combo.ValueField     = "ItemCode";
            combo.DataBind();
            combo.TextFormatString = "{0}";

            GridViewEditItemTemplateContainer container = combo.NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "ItemCode").ToString();
            }
        }