Ejemplo n.º 1
0
        private void InitListManager()
        {
            ucListManager.ID                = "DEntityList";
            ucListManager.IsChildList       = false;
            ucListManager.ListLabel         = "Entity List";
            ucListManager.AllowAdd          = true;
            ucListManager.AddBtnPostBackUrl = GetUrl(EntityEdit.PageUrl);

            ucListManager.NeedListInstances += new NeedListInstancesEventHandler(ucListManager_NeedListInstances);
            ucListManager.InstanceRowNewing += new InstanceRowNewingEventHandler(ucListManager_InstanceRowNewing);
            ucListManager.InstanceRowSaving += new InstanceRowSavingEventHandler(ucListManager_InstanceRowSaving);

            ucListManager.Columns.Add(new GridViewEditCommandColumn());

            GridViewHyperLinkColumn hc = new GridViewHyperLinkColumn();

            ucListManager.Columns.Add(hc);
            hc.Caption       = "Entity Code";
            hc.DataTextField = DEntityDto.FLD_Code;
            hc.DataNavigateUrlFormatString = string.Format("{0}?{1}={{0}}", ServerPath + EntityManager.PageUrl, EntityManager.QryEntityId);
            hc.DataNavigateUrlFields       = new string[] { DEntityDto.FLD_StringId };

            ucListManager.Columns.Add(new GridViewDataTextColumn("Description", DEntityDto.FLD_Description));
            ucListManager.Columns.Add(new GridViewDataCheckColumn("Allow Add Item", DEntityDto.FLD_AllowAddItem));
            ucListManager.Columns.Add(new GridViewDataCheckColumn("Allow Edit Item", DEntityDto.FLD_AllowEditItem));
            ucListManager.Columns.Add(new GridViewDataCheckColumn("Allow Delete Item", DEntityDto.FLD_AllowDeleteItem));
            GridViewDataCheckColumn cc = new GridViewDataCheckColumn("Is BuiltIn", DEntityDto.FLD_IsBuiltIn);

            ucListManager.Columns.Add(cc);
            cc.IsReadOnly = true;
        }
        private void CreateDetailColumns(ASPxGridView detailGrid)
        {
            GridViewCommandColumn colCmd = new GridViewCommandColumn();

            colCmd.ShowEditButton   = true;
            colCmd.ShowNewButton    = true;
            colCmd.ShowDeleteButton = true;
            detailGrid.Columns.Add(colCmd);

            GridViewDataColumn colProductID = new GridViewDataColumn();

            colProductID.FieldName = "ProductID";
            colProductID.EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.False;
            detailGrid.Columns.Add(colProductID);

            detailGrid.Columns.Add(new GridViewDataColumn("ProductName"));

            GridViewDataTextColumn colCategoryID = new GridViewDataTextColumn();

            colCategoryID.FieldName = "CategoryID";
            colCategoryID.EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.False;
            detailGrid.Columns.Add(colCategoryID);

            detailGrid.Columns.Add(new GridViewDataColumn("UnitPrice"));

            GridViewDataCheckColumn colDiscontinued = new GridViewDataCheckColumn();

            colDiscontinued.FieldName = "Discontinued";
            detailGrid.Columns.Add(colDiscontinued);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns <see cref="GridViewEditDataColumn"/> instance based on meta data passed in column argument.
        /// </summary>
        /// <param name="column">An instance of <see cref="ColumnMeta"/> containing meta data of column to be created.</param>
        /// <param name="connectionString">Connection string to underlying database.</param>
        /// <returns></returns>
        internal static GridViewEditDataColumn AddGridViewDataColumn(ColumnMeta column, string connectionString)
        {
            GridViewEditDataColumn dataColumn = null;

            // As per 11 Oct 2016, the following evaluation criteria for data type and its column editor are not yet complete.
            // We still has some works to do to deal with picture and blob/document. (--github.com/ganagus)
            // ---
            if ((new TypeCode[] { TypeCode.String, TypeCode.Int64, TypeCode.Int32, TypeCode.Single, TypeCode.Decimal })
                .Contains(column.DataType) && !column.IsForeignKey && string.IsNullOrEmpty(column.EnumTypeName))
            {
                // regular text column, editor => text box
                dataColumn = AddGridViewDataTextColumn(column, dataColumn);
            }
            else if (!string.IsNullOrEmpty(column.EnumTypeName))
            {
                // enum data type column, editor => check box
                dataColumn = AddGridViewEnumColumn(column, dataColumn);
            }
            // foreign key should be rendered in combo box column
            else if (column.IsForeignKey)
            {
                // foreign key column, it's a look up to other table, editor => combo box
                dataColumn = AddGridViewForeignKeyColumn(column, dataColumn, connectionString);
            }
            else if (column.DataType == TypeCode.DateTime)
            {
                // date / datetime column, editor => DevExpress date editor
                dataColumn = new GridViewDataDateColumn();
                if (column.Name.ToLower() == "createddate" || column.Name.ToLower() == "modifieddate")
                {
                    //hide createdby, createddate, modifiedby, modifieddate from edit form
                    //dataColumn.EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.False;
                }
            }
            else if (column.DataType == TypeCode.Boolean)
            {
                // boolean column, editor => check box
                dataColumn = new GridViewDataCheckColumn();
            }
            else
            {
                // other data type, default to text box
                dataColumn = new GridViewDataTextColumn();
            }

            if (column.IsIdentity)
            {
                dataColumn.EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.False;
            }

            dataColumn.FieldName    = column.Name;
            dataColumn.Caption      = column.Caption;
            dataColumn.VisibleIndex = column.OrderNo;

            return(dataColumn);
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Ham tạo Column cho Gridview loại GridViewDataCheckColumn
    /// </summary>
    /// <param name="Caption">Tiêu đề cho column</param>
    /// <param name="FieldName">FieldName cho column</param>
    /// <param name="Width">Độ rộng cho column</param>
    /// <returns>GridViewDataCheckColumn</returns>
    public GridViewDataCheckColumn BuildCheckColumn(string Caption, string FieldName, string Alias, int Width)
    {
        GridViewDataCheckColumn checkColumn = new GridViewDataCheckColumn();
        checkColumn.Caption = Caption;
        checkColumn.FieldName = Alias + FieldName;
        checkColumn.MinWidth = 80;
        if (Width != 0)
            checkColumn.Width = Unit.Pixel(Width);

        return checkColumn;
    }
Ejemplo n.º 5
0
    private void loadMasterData()
    {
        dthiDTO = new clsDiaDiemThi_DTO();
        DataTable dt = new DataTable();

        dt = dthiDAL.getDiaDiemThi(dthiDTO);

        cboDiemThi.ValueField = "MaDiemThi";
        cboDiemThi.TextField  = "DiaChi";

        cboDiemThi.DataSource = dt;
        cboDiemThi.DataBind();

        //GridViewDataComboBoxColumn gclDiemThi = gvPhongThi.Columns["DiaChi"] as GridViewDataComboBoxColumn;
        //gclDiemThi.PropertiesComboBox.DataSource = dt;
        //gclDiemThi.PropertiesComboBox.ValueField = "MaDienThi";
        //gclDiemThi.PropertiesComboBox.TextField = "TenDiemThi";

        GridViewDataCheckColumn gclTrangThai = gvPhongThi.Columns["TrangThai"] as GridViewDataCheckColumn;

        gclTrangThai.PropertiesCheckEdit.DisplayTextChecked = "Chon";
    }
Ejemplo n.º 6
0
        internal static void BuildColumnsByEntity(BusinessMapper.eEntities entidad, ASPxGridView gv)
        {
            if (BusinessMapper.AbmConfigXmlPath == null || BusinessMapper.AbmConfigXmlPath == string.Empty)
                throw new Exception("Path del archivo AbmConfig.xml sin definir.");

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(BusinessMapper.AbmConfigXmlPath);

            gv.Columns.Clear();

            if (xDoc.SelectSingleNode(
                "Entities/Entity[@EntityName='" + entidad.ToString() + "']") == null)
                throw new AbmConfigXMLException("No existe la configuración de mapeo para la entidad: " + entidad.ToString());

            foreach (XmlNode nodeControl in xDoc.SelectSingleNode(
                "Entities/Entity[@EntityName='" + entidad.ToString() + "']").ChildNodes)
            {

                if (nodeControl.Attributes["ControlType"].Value == "ComboBox")
                {
                    GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

                    gvc.Name = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    var mapInfo = BusinessMapper.GetMapInfo(nodeControl.Attributes["EntityName"].Value);

                    gvc.PropertiesComboBox.TextField = mapInfo.EntityTextField;
                    gvc.PropertiesComboBox.ValueField = mapInfo.EntityValueField;
                    gvc.PropertiesComboBox.DataSource = mapInfo.DAOHandler.ReadAll("");

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "RadioButtonList")
                {
                    GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

                    gvc.Name = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gvc.PropertiesComboBox.Items.Clear();
                    foreach (XmlNode item in nodeControl.ChildNodes[0].ChildNodes)
                    {
                        gvc.PropertiesComboBox.Items.Add(item.Attributes["Name"].Value, item.Attributes["Value"].Value);
                    }

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "TextBox"
                    || nodeControl.Attributes["ControlType"].Value == "SpinEdit"
                    || nodeControl.Attributes["ControlType"].Value == "TimeEdit")
                {
                    GridViewDataTextColumn gvc = new GridViewDataTextColumn();

                    gvc.Name = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "DateEdit")
                {
                    GridViewDataDateColumn gvc = new GridViewDataDateColumn();

                    gvc.Name = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "CheckBox")
                {
                    GridViewDataCheckColumn gvc = new GridViewDataCheckColumn();

                    gvc.Name = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
            }
        }
Ejemplo n.º 7
0
        internal static void BuildColumnsByEntity(BusinessMapper.eEntities entidad, ASPxGridView gv)
        {
            if (BusinessMapper.AbmConfigXmlPath == null || BusinessMapper.AbmConfigXmlPath == string.Empty)
            {
                throw new Exception("Path del archivo AbmConfig.xml sin definir.");
            }

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(BusinessMapper.AbmConfigXmlPath);

            gv.Columns.Clear();

            if (xDoc.SelectSingleNode(
                    "Entities/Entity[@EntityName='" + entidad.ToString() + "']") == null)
            {
                throw new AbmConfigXMLException("No existe la configuración de mapeo para la entidad: " + entidad.ToString());
            }


            foreach (XmlNode nodeControl in xDoc.SelectSingleNode(
                         "Entities/Entity[@EntityName='" + entidad.ToString() + "']").ChildNodes)
            {
                if (nodeControl.Attributes["ControlType"].Value == "ComboBox")
                {
                    GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    var mapInfo = BusinessMapper.GetMapInfo(nodeControl.Attributes["EntityName"].Value);

                    gvc.PropertiesComboBox.TextField  = mapInfo.EntityTextField;
                    gvc.PropertiesComboBox.ValueField = mapInfo.EntityValueField;
                    gvc.PropertiesComboBox.DataSource = mapInfo.DAOHandler.ReadAll("");

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "RadioButtonList")
                {
                    GridViewDataComboBoxColumn gvc = new GridViewDataComboBoxColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gvc.PropertiesComboBox.Items.Clear();
                    foreach (XmlNode item in nodeControl.ChildNodes[0].ChildNodes)
                    {
                        gvc.PropertiesComboBox.Items.Add(item.Attributes["Name"].Value, item.Attributes["Value"].Value);
                    }

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "TextBox" ||
                         nodeControl.Attributes["ControlType"].Value == "SpinEdit" ||
                         nodeControl.Attributes["ControlType"].Value == "TimeEdit")
                {
                    GridViewDataTextColumn gvc = new GridViewDataTextColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "DateEdit")
                {
                    GridViewDataDateColumn gvc = new GridViewDataDateColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
                else if (nodeControl.Attributes["ControlType"].Value == "CheckBox")
                {
                    GridViewDataCheckColumn gvc = new GridViewDataCheckColumn();

                    gvc.Name      = nodeControl.Attributes["FieldName"].Value;
                    gvc.Caption   = nodeControl.Attributes["Title"].Value;
                    gvc.FieldName = nodeControl.Attributes["FieldName"].Value;

                    gv.Columns.Add(gvc);
                }
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.Sallary, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/HR/UnAuthorized.aspx");
                }
            }
            //HashSet<string> addedColumns = new HashSet<string>{{ "ID", "EmpName", "EmpCode", "totalPenalty", "VacationsWithDeduction", "totalLiability", "FinalSalary", "Paid" };
            ResourceManager rm;

            if (Session["lang"] == "ar-EG")
            {
                rm = new ResourceManager("Sallary.ar-EG", System.Reflection.Assembly.GetExecutingAssembly());
            }
            else
            {
                rm = new ResourceManager("Sallary", System.Reflection.Assembly.GetExecutingAssembly());
            }
            if (!IsPostBack)
            {
                PayGrades pg = new PayGrades();
                pg.getSallaryItems();
                DataTable          dt       = pg.PayGradesSallaryItems;
                GridViewDataColumn ThisBool = new GridViewDataColumn();
                //ThisBool = (GridViewColumn)ASPxGridView1.Columns[0];
                //ASPxGridView1.Columns.Clear();
                //ASPxGridView1.Columns.Add(ThisBool);
                DataRow dr = dt.NewRow();
                dr["Name"] = "EmpID";
                dt.Rows.InsertAt(dr, 0);
                dr         = dt.NewRow();
                dr["Name"] = "EmpName";
                dt.Rows.InsertAt(dr, 1);
                dr         = dt.NewRow();
                dr["Name"] = "EmpCode";
                dt.Rows.InsertAt(dr, 2);
                dr         = dt.NewRow();
                dr["Name"] = "totalPenalty";
                dt.Rows.InsertAt(dr, dt.Rows.Count);
                dr         = dt.NewRow();
                dr["Name"] = "VacationsWithDeduction";
                dt.Rows.InsertAt(dr, dt.Rows.Count);
                dr         = dt.NewRow();
                dr["Name"] = "totalLiability";
                dt.Rows.InsertAt(dr, dt.Rows.Count);
                dr         = dt.NewRow();
                dr["Name"] = "FinalSalary";
                dt.Rows.InsertAt(dr, dt.Rows.Count);
                dr         = dt.NewRow();
                dr["Name"] = "Paid";
                dt.Rows.InsertAt(dr, dt.Rows.Count);

                /*dr["Name"] = "EmpID";
                 * dt.Rows.InsertAt(dr, 0);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("EmpName").ToString();
                 * dt.Rows.InsertAt(dr, 1);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("EmpCode").ToString();
                 * dt.Rows.InsertAt(dr, 2);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("totalPenalty").ToString();
                 * dt.Rows.InsertAt(dr, dt.Rows.Count);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("VacationsWithDeduction").ToString();
                 * dt.Rows.InsertAt(dr, dt.Rows.Count);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("totalLiability").ToString();
                 * dt.Rows.InsertAt(dr, dt.Rows.Count);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("FinalSalary").ToString();
                 * dt.Rows.InsertAt(dr, dt.Rows.Count);
                 * dr = dt.NewRow();
                 * dr["Name"] = GetLocalResourceObject("Paid").ToString();
                 * dt.Rows.InsertAt(dr, dt.Rows.Count);*/
                /* dt.Rows.InsertAt(dr, 1);
                 * dt.Columns.Add("EmpID");
                 * dt.Columns.Add("EmpName");
                 * dt.Columns.Add("EmpCode");
                 * dt.Columns.Add("totalDeserved");
                 * dt.Columns.Add("totalLiability");
                 * dt.Columns.Add("FinalSalary");
                 * dt.Columns.Add("Paid");*/
                int added = 0;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Name"] != "Paid")
                    {
                        if (dt.Rows[i]["Nature"].ToString() == "2" && added == 0)
                        {
                            ThisBool           = new GridViewDataColumn();
                            ThisBool.Caption   = GetLocalResourceObject("Rewards").ToString();
                            ThisBool.FieldName = "Rewards";
                            ThisBool.Visible   = true;
                            ASPxGridView1.Columns.Add(ThisBool);

                            ThisBool           = new GridViewDataColumn();
                            ThisBool.Caption   = GetLocalResourceObject("totalDeserved").ToString();
                            ThisBool.FieldName = "totalDeserved";
                            ThisBool.Visible   = true;
                            ASPxGridView1.Columns.Add(ThisBool);
                            added = 1;
                        }
                        ThisBool = new GridViewDataColumn();
                        if (GetLocalResourceObject(dt.Rows[i]["Name"].ToString()) != null)
                        {
                            ThisBool.Caption = GetLocalResourceObject(dt.Rows[i]["Name"].ToString()).ToString();
                        }
                        else
                        {
                            ThisBool.Caption = dt.Rows[i]["Name"].ToString();
                        }
                        ThisBool.FieldName = dt.Rows[i]["Name"].ToString();
                        if (dt.Rows[i]["Name"].ToString() == "EmpID")
                        {
                            ThisBool.Visible = false;
                        }
                        else
                        {
                            ThisBool.Visible = true;
                        }
                        ASPxGridView1.Columns.Add(ThisBool);
                    }
                    else
                    {
                        GridViewDataCheckColumn ThisBool2 = new GridViewDataCheckColumn();
                        ThisBool2.Caption   = GetLocalResourceObject("Paid").ToString();
                        ThisBool2.FieldName = "Paid";
                        ThisBool2.Visible   = true;
                        ASPxGridView1.Columns.Add(ThisBool2);
                    }
                }
            }
            else
            {
                if (ddlMonth.SelectedValue != "" && ddlYear.SelectedValue != "")
                {
                    FillGrid();

                    DataTable dt = (DataTable)Session["table"];
                    ASPxGridView1.DataSource = dt;
                    // ThisBool.FieldName = "Discontinued";
                    ASPxGridView1.DataBind();
                }
            }
            AddSubmitEvent();
        }