コード例 #1
0
        public override void InitGridControlDataSource()
        {
            TimeSheetEntities entity = (TimeSheetEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity;
            BindingSource     bds    = new BindingSource();

            bds.DataSource = entity.EmployeeTimeSheetsList;
            DataSource     = bds;
        }
コード例 #2
0
ファイル: TimesheetController.cs プロジェクト: Manojptpl/ots
        public JsonResult SubmitMainPage(TimeSheetEntities entity)
        {
            int      Emp_id   = Convert.ToInt32(Session["Emp_id"]);
            int      Add_By   = Convert.ToInt32(Session["Emp_id"]);
            DateTime Add_Date = DateTime.Today;
            int      Status   = 1;
            int      Deleted  = 0;

            string res = ts_layer.SubmitTimeSheet(Emp_id, entity.Date, entity.WorkType_id, entity.Project_id, entity.Time_from, entity.Time_to, entity.Description, entity.Customer_id, Add_By, Add_Date, Status, Deleted);

            if (res == "Success")
            {
                hm.SuccessMsg = "Entry Successfully Created.";
            }
            else
            {
                hm.ErrorMsg = res;
            }

            return(Json(hm, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        /// <summary>
        /// Initialize BandedGridView
        /// </summary>
        /// <param name="gridView"></param>
        /// <returns></returns>
        private BandedGridView InitializeBandedGridView(GridView gridView)
        {
            TimeSheetEntities entity            = (TimeSheetEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity;
            HRTimeSheetsInfo  objTimeSheetsInfo = (HRTimeSheetsInfo)entity.MainObject;

            //Creat a banded grid view
            BandedGridView bandedView = new BandedGridView();
            GridBand       gridBand1  = new GridBand();
            GridBand       gridBand2  = new GridBand();
            GridBand       gridBand3  = new GridBand();

            bandedView.Bands.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.GridBand[] {
                gridBand1,
                gridBand2,
                gridBand3
            });
            for (int i = 0; i < gridView.Columns.Count; i++)
            {
                bandedView.Columns.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn[] {
                    ConvertToBandedGridColumn(gridView.Columns[i], false)
                });
            }
            bandedView.GridControl = this;
            bandedView.Name        = "bandedGridView1";
            bandedView.OptionsCustomization.AllowFilter     = false;
            bandedView.OptionsView.ShowAutoFilterRow        = true;
            bandedView.OptionsView.ColumnAutoWidth          = false;
            bandedView.OptionsView.ShowGroupPanel           = false;
            bandedView.OptionsCustomization.AllowSort       = true;
            bandedView.OptionsView.ShowChildrenInGroupPanel = false;
            bandedView.OptionsView.ShowDetailButtons        = false;

            //GridBand1
            gridBand1.Caption = "Thông tin nhân viên";
            gridBand1.Fixed   = DevExpress.XtraGrid.Columns.FixedStyle.Left;
            gridBand1.Name    = "gridBand1";

            //GridBand2
            gridBand2.Caption = "Danh sách ngày";
            gridBand2.Fixed   = DevExpress.XtraGrid.Columns.FixedStyle.None;
            gridBand2.Name    = "gridBand2";

            //GridBand3
            gridBand3.Caption = "Quy ra công";
            gridBand3.Fixed   = DevExpress.XtraGrid.Columns.FixedStyle.None;
            gridBand3.Name    = "gridBand3";

            // Assigning columns to bands
            GridColumn column = gridView.Columns["HREmployeeCardNumber"];

            if (column != null)
            {
                CreateNewColumn(column, gridBand1, false);
            }
            column = gridView.Columns["HREmployeeName"];
            if (column != null)
            {
                CreateNewColumn(column, gridBand1, false);
            }

            column = gridView.Columns["HRDepartmentRoomName"];
            if (column != null)
            {
                CreateNewColumn(column, gridBand1, false);
            }

            //int dateStart = objTimeSheetsInfo.HRTimeSheetFromDate.Day;
            for (int i = 1; i <= 31; i++)
            {
                column = gridView.Columns[String.Format("{0}{1}", "HREmployeeTimeSheetDate", i.ToString())];
                if (column != null)
                {
                    CreateNewColumn(column, gridBand2, false);
                }
            }

            column = gridView.Columns["HREmployeeTimeSheetWorkingQty"];
            if (column != null)
            {
                CreateNumericColumn(column, gridBand3, false, "n1");
            }

            if (WorkingShiftList != null)
            {
                WorkingShiftList.ForEach(o =>
                {
                    column = gridView.Columns["CONG" + o.ADWorkingShiftID.ToString()];
                    if (column != null)
                    {
                        column.Caption = "Công " + o.ADWorkingShiftName;
                        CreateNumericColumn(column, gridBand3, false, "n5");
                    }
                });
            }

            HRTimeSheetParamsController  objTimeSheetParamsController = new HRTimeSheetParamsController();
            List <HRTimeSheetParamsInfo> OTFactorlist = objTimeSheetParamsController.GetDistinctOTTimeSheetParamsList();

            foreach (var item in OTFactorlist)
            {
                column = gridView.Columns[item.HRTimeSheetParamValue2.ToString()];
                if (column != null)
                {
                    column.Caption = "TC HS " + item.HRTimeSheetParamValue2.ToString();
                    CreateNumericColumn(column, gridBand3, false, "n3");
                }
            }
            column = gridView.Columns["HREmployeeTimeSheetOTQty"];
            if (column != null)
            {
                CreateNumericColumn(column, gridBand3, false, "n3");
            }

            column = gridView.Columns["HREmployeeTimeSheetLeaveQty"];
            if (column != null)
            {
                CreateNumericColumn(column, gridBand3, false, "n1");
            }

            column = gridView.Columns["HREmployeeTimeSheetNghiLe"];
            if (column != null)
            {
                CreateNumericColumn(column, gridBand3, false, "n1");
            }

            bandedView.CustomDrawCell   += new RowCellCustomDrawEventHandler(BandedView_CustomDrawCell);
            bandedView.CellValueChanged += new CellValueChangedEventHandler(BandedView_CellValueChanged);
            bandedView.RowClick         += new RowClickEventHandler(BandedView_RowClick);
            bandedView.KeyUp            += new KeyEventHandler(BandedView_KeyUp);
            return(bandedView);
        }
コード例 #4
0
        protected override void AddColumnsToGridView(string strTableName, DevExpress.XtraGrid.Views.Grid.GridView gridView)
        {
            base.AddColumnsToGridView(strTableName, gridView);
            GridColumn column = new GridColumn();

            column.Caption   = "Mã nhân viên";
            column.FieldName = "HREmployeeNo";
            gridView.Columns.Add(column);

            column           = new GridColumn();
            column.Caption   = "Mã ID";
            column.FieldName = "HREmployeeCardNumber";
            gridView.Columns.Add(column);

            column           = new GridColumn();
            column.Caption   = "Chi nhánh";
            column.FieldName = "BRBranchName";
            gridView.Columns.Add(column);

            column           = new GridColumn();
            column.Caption   = "Bộ phận";
            column.FieldName = "HRDepartmentRoomName";
            gridView.Columns.Add(column);

            column           = new GridColumn();
            column.Caption   = "Phòng ban";
            column.FieldName = "HRDepartmentName";
            gridView.Columns.Add(column);

            column           = new GridColumn();
            column.Caption   = "Tên nhân viên";
            column.FieldName = "HREmployeeName";
            gridView.Columns.Add(column);

            column           = new GridColumn();
            column.Caption   = "Tổ";
            column.FieldName = "HRDepartmentRoomGroupItemName";
            gridView.Columns.Add(column);

            int numDays = ((TimeSheetModule)Screen.Module).NumOfDayInMonth();
            TimeSheetEntities entity            = (TimeSheetEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity;
            HRTimeSheetsInfo  objTimeSheetsInfo = (HRTimeSheetsInfo)entity.MainObject;

            for (int i = 1; i <= numDays; i++)
            {
                GridColumn columnDays = new GridColumn();
                DateTime   dt         = objTimeSheetsInfo.HRTimeSheetFromDate.Date.AddDays(i - 1);
                columnDays.Caption = dt.ToString("dd/MM");
                bool isDayOfWeek = (VinaApp.IsEndOfWeek(dt.DayOfWeek));
                if (isDayOfWeek)
                {
                    columnDays.Caption = "CN (" + dt.ToString("dd/MM") + ")";
                }
                columnDays.FieldName = String.Format("{0}{1}", "HREmployeeTimeSheetDate", i.ToString());
                gridView.Columns.Add(columnDays);
            }
            HRTimeSheetParamsController  objTimeSheetParamsController = new HRTimeSheetParamsController();
            List <HRTimeSheetParamsInfo> OTFactorlist = objTimeSheetParamsController.GetDistinctOTTimeSheetParamsList();

            foreach (var item in OTFactorlist)
            {
                column           = new GridColumn();
                column.Caption   = "TC HS " + item.HRTimeSheetParamValue2.ToString();
                column.FieldName = item.HRTimeSheetParamValue2.ToString();
                column.Tag       = item.HRTimeSheetParamValue2;
                gridView.Columns.Add(column);
            }

            if (WorkingShiftList != null)
            {
                WorkingShiftList.ForEach(o =>
                {
                    column           = new GridColumn();
                    column.Caption   = "Công " + o.ADWorkingShiftName;
                    column.FieldName = "CONG" + o.ADWorkingShiftID.ToString();
                    column.Tag       = "CONG" + o.ADWorkingShiftID.ToString();
                    gridView.Columns.Add(column);
                });
            }
        }