private void btnUpdate_Click(object sender, EventArgs e) { try { foreach (SuspectingInfoModel model in this.SuspectItems) { KryptonHeaderGroup grp = this.Controls.Find("dyna-" + model.CategoryID.ToString(), true).FirstOrDefault() as KryptonHeaderGroup; if (grp != null) { KryptonTextBox textboxDescription = this.Controls.Find("txt_" + model.CategoryID.ToString(), true).FirstOrDefault() as KryptonTextBox; if (textboxDescription != null) { model.CategoryDiscription = textboxDescription.Text.Trim(); } } } (new ServiceSalesLead()).UpdateSuspectingInfoForSalesLead(this.SuspectItems, this.SelectedID); PopulateSuspectInfoControls(); } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ctrlSuspectInfo::btnUpdate_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Initialize a new instance of the KryptonHeaderGroupActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonHeaderGroupActionList(KryptonHeaderGroupDesigner owner) : base(owner.Component) { // Remember the panel instance _headerGroup = owner.Component as KryptonHeaderGroup; // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
private void PrepareCalendarControl() { this.Cursor = Cursors.WaitCursor; try { int cols = 7; int rows = 5; DateTime startDate = new DateTime(dtAttendanceMonth.Value.Year, dtAttendanceMonth.Value.Month, 1); int days = DateTime.DaysInMonth(dtAttendanceMonth.Value.Year, dtAttendanceMonth.Value.Month); DateTime endDate = new DateTime(dtAttendanceMonth.Value.Year, dtAttendanceMonth.Value.Month, days); DateTime currDate = startDate; tableMonthCalendar.Controls.Clear(); tableMonthCalendar.ColumnStyles.Clear(); tableMonthCalendar.RowStyles.Clear(); tableMonthCalendar.VerticalScroll.Enabled = true; tableMonthCalendar.HorizontalScroll.Enabled = false; //Now we will generate the table, setting up the row and column counts first tableMonthCalendar.ColumnCount = cols; tableMonthCalendar.RowCount = rows; for (int x = 0; x < rows; x++) { //First add a column tableMonthCalendar.RowStyles.Add(new RowStyle(SizeType.AutoSize)); for (int y = 0; y < cols; y++) { //Next, add a row. Only do this when once, when creating the first column if (x == 0) { tableMonthCalendar.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20)); } KryptonHeaderGroup header = new KryptonHeaderGroup(); PrepareAttendanceDescription(header, currDate); tableMonthCalendar.Controls.Add(header, y, x); header.Dock = DockStyle.Fill; currDate = currDate.AddDays(1); if (currDate.Date > endDate.Date) { this.Cursor = Cursors.Default; return; } } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ControlEmployeeAttendanceViewer::PrepareCalendarControl", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Cursor = Cursors.Default; }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate the designer with.</param> public override void Initialize(IComponent component) { Debug.Assert(component != null); // Validate the parameter reference if (component == null) { throw new ArgumentNullException(nameof(component)); } // Let base class do standard stuff base.Initialize(component); // Cast to correct type _headerGroup = component as KryptonHeaderGroup; if (_headerGroup != null) { // Hook into header event _headerGroup.GetViewManager().MouseUpProcessed += new MouseEventHandler(OnHeaderGroupMouseUp); _headerGroup.GetViewManager().DoubleClickProcessed += new PointHandler(OnHeaderGroupDoubleClick); } // The resizing handles around the control need to change depending on the // value of the AutoSize and AutoSizeMode properties. When in AutoSize you // do not get the resizing handles, otherwise you do. AutoResizeHandles = true; // Acquire service interfaces _designerHost = (IDesignerHost)GetService(typeof(IDesignerHost)); _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); _selectionService = (ISelectionService)GetService(typeof(ISelectionService)); // We need to know when we are being removed _changeService.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving); // Let the internal panel in the container be designable if (_headerGroup != null) { EnableDesignMode(_headerGroup.Panel, "Panel"); } }
public KryptonHeaderGroupProxy(KryptonHeaderGroup headerGroup) { _headerGroup = headerGroup; }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate the designer with.</param> public override void Initialize(IComponent component) { Debug.Assert(component != null); // Validate the parameter reference if (component == null) throw new ArgumentNullException("component"); // Let base class do standard stuff base.Initialize(component); // Cast to correct type _headerGroup = component as KryptonHeaderGroup; if (_headerGroup != null) { // Hook into header event _headerGroup.GetViewManager().MouseUpProcessed += new MouseEventHandler(OnHeaderGroupMouseUp); _headerGroup.GetViewManager().DoubleClickProcessed += new PointHandler(OnHeaderGroupDoubleClick); } // The resizing handles around the control need to change depending on the // value of the AutoSize and AutoSizeMode properties. When in AutoSize you // do not get the resizing handles, otherwise you do. AutoResizeHandles = true; // Acquire service interfaces _designerHost = (IDesignerHost)GetService(typeof(IDesignerHost)); _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); _selectionService = (ISelectionService)GetService(typeof(ISelectionService)); // We need to know when we are being removed _changeService.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving); // Let the internal panel in the container be designable if (_headerGroup != null) EnableDesignMode(_headerGroup.Panel, "Panel"); }
/**************************************************************\ * Display Config Summary * * - The Name of the config (KryptonHeader). * * - Each process used in the config (KryptonHeaderGroup). * \**************************************************************/ public void DisplayConfigSummary(String name, List<Process>processList, String warning) { _ProcessHeaderGroupList.Clear(); _ProcessHeaderGroupList = new List<KryptonHeaderGroup>(); this.SummarySplitContainer1.Panel1.Controls.Clear(); // Display the name of the config KryptonHeader header = new KryptonHeader(); header.Dock = System.Windows.Forms.DockStyle.Top; header.Text = name; header.Values.Description = null; header.Values.Image = null; // Display each process foreach (Process element in processList) { KryptonHeaderGroup headerGroup = new KryptonHeaderGroup(); ButtonSpecHeaderGroup buttonSpecHeaderGroup = new ButtonSpecHeaderGroup(); headerGroup.Dock = System.Windows.Forms.DockStyle.Top; headerGroup.HeaderPositionSecondary = ComponentFactory.Krypton.Toolkit.VisualOrientation.Left; headerGroup.ValuesPrimary.Image = null; headerGroup.HeaderStylePrimary = ComponentFactory.Krypton.Toolkit.HeaderStyle.Secondary; headerGroup.ValuesSecondary.Heading = "Comments"; headerGroup.Text = element.Get_Name() + " - ID : " + element.Get_OrderId(); buttonSpecHeaderGroup.Tag = headerGroup; headerGroup.ButtonSpecs.AddRange(new ComponentFactory.Krypton.Toolkit.ButtonSpecHeaderGroup[] { buttonSpecHeaderGroup }); headerGroup.ButtonSpecs[0].Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.RibbonExpand; headerGroup.Size = new System.Drawing.Size(150, 23); KryptonRichTextBox richTextBox = new KryptonRichTextBox(); richTextBox.Dock = System.Windows.Forms.DockStyle.Fill; richTextBox.ReadOnly = true; richTextBox.Text = element.Get_Comment(); headerGroup.Panel.Controls.Add(richTextBox); _ProcessHeaderGroupList.Add(headerGroup); } _ProcessHeaderGroupList.Reverse(); foreach(KryptonHeaderGroup element in _ProcessHeaderGroupList) this.SummarySplitContainer1.Panel1.Controls.Add(element); var tmp = _WarningGroupBox.Panel.Controls.OfType<RichTextBox>(); foreach (RichTextBox element in tmp) { element.Text = warning; if (!element.Text.Equals("")) this.SummarySplitContainer1.Panel1.Controls.Add(_WarningGroupBox); } this.SummarySplitContainer1.Panel1.Controls.Add(header); }
/**************************************************************\ * Display Batch Summary * \**************************************************************/ public void DisplayBatchSummary(Batch batch) { _ProcessHeaderGroupList.Clear(); _ProcessHeaderGroupList = new List<KryptonHeaderGroup>(); this.SummarySplitContainer1.Panel1.Controls.Clear(); // Display the name of the batch KryptonHeader header = new KryptonHeader(); header.Dock = System.Windows.Forms.DockStyle.Top; header.Text = "Batch : " + batch.Get_Name(); header.Values.Description = null; header.Values.Image = null; // Display all batch elements if (batch.Get_BatchElements().Count > 0) { foreach (KeyValuePair<string, Tuple<string, string, string>> element in batch.Get_BatchElements()) { KryptonHeaderGroup headerGroup = new KryptonHeaderGroup(); ButtonSpecHeaderGroup buttonSpecHeaderGroup = new ButtonSpecHeaderGroup(); headerGroup.Dock = System.Windows.Forms.DockStyle.Top; headerGroup.HeaderPositionSecondary = ComponentFactory.Krypton.Toolkit.VisualOrientation.Left; headerGroup.ValuesPrimary.Image = null; headerGroup.HeaderStylePrimary = ComponentFactory.Krypton.Toolkit.HeaderStyle.Secondary; headerGroup.ValuesSecondary.Heading = "Target"; headerGroup.Text = element.Value.Item1; buttonSpecHeaderGroup.Tag = headerGroup; headerGroup.ButtonSpecs.AddRange(new ComponentFactory.Krypton.Toolkit.ButtonSpecHeaderGroup[] { buttonSpecHeaderGroup }); headerGroup.ButtonSpecs[0].Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.RibbonExpand; headerGroup.Size = new System.Drawing.Size(150, 23); KryptonRichTextBox richTextBox = new KryptonRichTextBox(); richTextBox.Dock = System.Windows.Forms.DockStyle.Fill; richTextBox.ReadOnly = true; richTextBox.Text = element.Key + "\n\n FTP : " + element.Value.Item3; headerGroup.Panel.Controls.Add(richTextBox); _ProcessHeaderGroupList.Add(headerGroup); } } else if (batch.Get_BatchElementsMulti().Count > 0) { foreach (KeyValuePair<Tuple<string, string>, List<Tuple<string, string>>> element in batch.Get_BatchElementsMulti()) { KryptonHeaderGroup headerGroup = new KryptonHeaderGroup(); ButtonSpecHeaderGroup buttonSpecHeaderGroup = new ButtonSpecHeaderGroup(); headerGroup.Dock = System.Windows.Forms.DockStyle.Top; headerGroup.HeaderPositionSecondary = ComponentFactory.Krypton.Toolkit.VisualOrientation.Left; headerGroup.ValuesPrimary.Image = null; headerGroup.HeaderStylePrimary = ComponentFactory.Krypton.Toolkit.HeaderStyle.Secondary; headerGroup.ValuesSecondary.Heading = "Target"; headerGroup.Text = element.Value[0].Item1; buttonSpecHeaderGroup.Tag = headerGroup; headerGroup.ButtonSpecs.AddRange(new ComponentFactory.Krypton.Toolkit.ButtonSpecHeaderGroup[] { buttonSpecHeaderGroup }); headerGroup.ButtonSpecs[0].Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.RibbonExpand; headerGroup.Size = new System.Drawing.Size(150, 23); KryptonRichTextBox richTextBox = new KryptonRichTextBox(); richTextBox.Dock = System.Windows.Forms.DockStyle.Fill; richTextBox.ReadOnly = true; richTextBox.AppendText( "FTP : " + element.Key.Item2 + "\n\n"); richTextBox.AppendText("Target path : " + element.Key.Item1 + "\n\n"); richTextBox.AppendText("Configs :\n"); foreach (Tuple<string, string> config in element.Value) richTextBox.AppendText(config.Item1 + "\n"); headerGroup.Panel.Controls.Add(richTextBox); _ProcessHeaderGroupList.Add(headerGroup); } } _ProcessHeaderGroupList.Reverse(); foreach (KryptonHeaderGroup element in _ProcessHeaderGroupList) this.SummarySplitContainer1.Panel1.Controls.Add(element); this.SummarySplitContainer1.Panel1.Controls.Add(header); }
public void PopulateSuspectInfoControls() { try { switch (this.ENTITY) { case APP_ENTITIES.SALES_LEAD: this.SuspectItems = (new ServiceSalesLead()).GetSuspectingInfoForSalesLead(this.SelectedID); headerGroupSuspectInfo.Panel.Controls.Clear(); int i = SuspectItems.Count; foreach (SuspectingInfoModel model in SuspectItems) { KryptonHeaderGroup grp = new KryptonHeaderGroup() { Name = string.Format("dyna-{0}", model.CategoryID) }; grp.Height = 100; grp.HeaderStylePrimary = HeaderStyle.DockActive; grp.ValuesPrimary.Heading = model.CategoryName; grp.HeaderVisibleSecondary = false; KryptonTextBox txtCategoryDescription = new KryptonTextBox(); txtCategoryDescription.Name = string.Format("txt_{0}", model.CategoryID); txtCategoryDescription.Text = model.CategoryDiscription; txtCategoryDescription.Multiline = true; txtCategoryDescription.ReadOnly = ReadOnly; grp.Tag = model.CategoryID; grp.Panel.Controls.Add(txtCategoryDescription); txtCategoryDescription.Dock = DockStyle.Fill; grp.Dock = DockStyle.Top; grp.TabIndex = i--; headerGroupSuspectInfo.Panel.Controls.Add(grp); } //gridData.DataSource = (new ServiceSalesLead()).GetSuspectingInfoForSalesLead(this.SelectedID); //gridData.Columns["Entity"].Visible = gridData.Columns["PKId"].Visible = gridData.Columns["CategoryID"].Visible = false; //gridData.Columns["CategoryName"].ReadOnly = true; //gridData.Columns["CategoryName"].Width = (int)(gridData.Width*.3); //gridData.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True; //int headerHeight = this.gridData.ColumnHeadersHeight; //int height = this.gridData.Size.Height - headerHeight; //int rowHeight = height / this.gridData.RowCount; // -1; //this.gridData.RowTemplate.Height = rowHeight; //gridData.DataSource = (new ServiceSalesLead()).GetSuspectingInfoForSalesLead(this.SelectedID); //gridData.Columns["CategoryDiscription"].DefaultCellStyle.WrapMode = DataGridViewTriState.True; //for(int i=0;i<gridData.Rows.Count;i++) //{ // DataGridViewCellStyle style = new DataGridViewCellStyle(); // style.WrapMode = DataGridViewTriState.True; // ((DataGridViewTextBoxCell)gridData.Rows[i].Cells["CategoryDiscription"]).Style = style; //} break; } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ctrlSuspectInfo::PopulateSuspectInfoControls", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void PrepareAttendanceDescription(KryptonHeaderGroup header, DateTime currDate) { string strDescription = string.Empty; int employeeID = 0; List <AttendanceColorModel> lstColors = (new ServiceEmployee()).GetAttendanceColorPreferencesOfEmployee(Program.CURR_USER.EmployeeID); try { header.HeaderStylePrimary = HeaderStyle.DockActive; string description = string.Empty; header.ValuesPrimary.Heading = string.Format("{0} ({1})", currDate.ToString("dd MMM"), currDate.ToString("ddd")); header.ValuesPrimary.Image = null; header.ValuesSecondary.Heading = string.Empty; List <vAttendanceRegister> dbItems = (new ServiceAttendance()).GetAttendanceInfoDbRecordsOfEmplyeeOnDate(this.EmployeeID, currDate); strDescription = string.Empty; foreach (vAttendanceRegister item in dbItems) { strDescription += string.Format("{1}-{2} {0}", item.AttendanceRemarks, item.AttendInTime.ToString("hh:mmtt"), item.AttendOutTime.ToString("hh:mmtt")); strDescription += (item.AtWarehouse) ? "At Warehouse ":""; if (item.AttendanceType == (int)ATTENDANCE_TYPE.LEAVE || item.AttendanceType == (int)ATTENDANCE_TYPE.OUT_DOOR) { strDescription += string.Format("({0})\n\n", (item.IsActive)?"Approved":"Unapproved"); if (item.isLeaveRejected == true) { strDescription = string.Empty; strDescription += string.Format("{1}-{2} {0}", item.AttendanceRemarks, item.AttendInTime.ToString("hh:mmtt"), item.AttendOutTime.ToString("hh:mmtt")); strDescription += (item.AtWarehouse) ? "At Warehouse " : ""; strDescription += string.Format("(Rejected)\n\n"); } } } Label lblDescription = new Label(); lblDescription.BackColor = Color.Transparent; lblDescription.Text = strDescription; header.Panel.Controls.Add(lblDescription); lblDescription.Dock = DockStyle.Fill; if (dbItems.Count > 0) { if (dbItems.Count == 1) { vAttendanceRegister dbItem = dbItems[0]; ATTENDANCE_TYPE attendanceTYPE = (ATTENDANCE_TYPE)dbItem.AttendanceType; switch (attendanceTYPE) { case ATTENDANCE_TYPE.PRESENT: header.ValuesPrimary.Description = "Present"; //header.ValuesSecondary.Heading = string.Format("{0} - {1}", dbItem.AttendInTime.ToString("hh:mm tt"), dbItem.AttendOutTime.ToString("hh:mm tt")); //header.ValuesSecondary.Description = string.Format("{0}", dbItem.AttendanceRemarks); header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.PRESENT).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.ABSENT: header.ValuesPrimary.Description = "Absent"; //header.ValuesSecondary.Heading = string.Format("{0} - {1}", dbItem.AttendInTime.ToString("hh:mm tt"), dbItem.AttendOutTime.ToString("hh:mm tt")); //header.ValuesSecondary.Description = string.Format("{0}", dbItem.AttendanceRemarks); header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.ABSENT).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.LEAVE: header.ValuesPrimary.Description = "Leave"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.LEAVE).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.OUT_DOOR: header.ValuesPrimary.Description = "Outdoor"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.OUT_DOOR).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.COMP_OFF: header.ValuesPrimary.Description = "CompOff"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.COMP_OFF).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.LATE_COMING: header.ValuesPrimary.Description = "Late Coming"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.LATE_COMING).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.EARLY_GOING: header.ValuesPrimary.Description = "Early Leaving"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.EARLY_GOING).FirstOrDefault().ColorAttendance; break; case ATTENDANCE_TYPE.SANDWICH_LEAVE: header.ValuesPrimary.Description = "Sandwich Leave"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.LEAVE).FirstOrDefault().ColorAttendance; break; } } else { header.ValuesPrimary.Description = "Multiple Entries"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.MULTIPLE).FirstOrDefault().ColorAttendance; } } ServiceHolidayAndWeekOffs serviceOff = new ServiceHolidayAndWeekOffs(); if (serviceOff.IsHolidayOrWeekOff(currDate)) { TBL_MP_HR_HolidaysAndWeekOff dbOff = serviceOff.GetHolidayDbRecordByDate(currDate); if (dbOff != null) { if (dbOff.HolidayType == (int)ATTENDANCE_TYPE.WEEK_OFF) { if (AppCommon.isSecondSaturday(currDate) || AppCommon.isFourthSaturday(currDate)) { if ((new ServiceEmployee()).IsWeekOffDayForEmployee("SATURDAY", this.EmployeeID)) { header.ValuesPrimary.Description = "Week Off"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.WEEK_OFF).FirstOrDefault().ColorAttendance; strDescription += string.Format("Week Off {0}", dbOff.Remarks); lblDescription.Text = strDescription; } } else { header.ValuesPrimary.Description = "Week Off"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.WEEK_OFF).FirstOrDefault().ColorAttendance; strDescription += string.Format("Week Off {0}", dbOff.Remarks); lblDescription.Text = strDescription; } } if (dbOff.HolidayType == (int)ATTENDANCE_TYPE.HOLIDAY) { header.ValuesPrimary.Description = "Holiday"; header.StateCommon.Back.Color1 = lstColors.Where(x => x.TypeAttendance == ATTENDANCE_TYPE.HOLIDAY).FirstOrDefault().ColorAttendance; strDescription += string.Format("Holiday {0}", dbOff.Remarks); lblDescription.Text = strDescription; } } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ControlEmployeeAttendanceViewer::PrepareAttendanceDescription", MessageBoxButtons.OK, MessageBoxIcon.Error); } }