Esempio n. 1
0
        private void OnAddServiceGroup()
        {
            dlgAddServiceGroup dlg = new dlgAddServiceGroup();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                DataTable dt = dgServiceGroup.DataSource as DataTable;
                if (dt == null)
                {
                    return;
                }
                DataRow newRow = dt.NewRow();
                newRow["Checked"]          = false;
                newRow["ServiceGroupGUID"] = dlg.ServiceGroup.ServiceGroupGUID.ToString();
                newRow["Code"]             = dlg.ServiceGroup.Code;
                newRow["Name"]             = dlg.ServiceGroup.Name;
                newRow["Note"]             = dlg.ServiceGroup.Note;
                newRow["EnglishName"]      = dlg.ServiceGroup.EnglishName;

                if (dlg.ServiceGroup.CreatedDate.HasValue)
                {
                    newRow["CreatedDate"] = dlg.ServiceGroup.CreatedDate;
                }

                if (dlg.ServiceGroup.CreatedBy.HasValue)
                {
                    newRow["CreatedBy"] = dlg.ServiceGroup.CreatedBy.ToString();
                }

                if (dlg.ServiceGroup.UpdatedDate.HasValue)
                {
                    newRow["UpdatedDate"] = dlg.ServiceGroup.UpdatedDate;
                }

                if (dlg.ServiceGroup.UpdatedBy.HasValue)
                {
                    newRow["UpdatedBy"] = dlg.ServiceGroup.UpdatedBy.ToString();
                }

                if (dlg.ServiceGroup.DeletedDate.HasValue)
                {
                    newRow["DeletedDate"] = dlg.ServiceGroup.DeletedDate;
                }

                if (dlg.ServiceGroup.DeletedBy.HasValue)
                {
                    newRow["DeletedBy"] = dlg.ServiceGroup.DeletedBy.ToString();
                }

                newRow["Status"] = dlg.ServiceGroup.Status;
                dt.Rows.Add(newRow);
            }
        }
Esempio n. 2
0
        private void OnEditServiceGroup()
        {
            if (dgServiceGroup.SelectedRows == null || dgServiceGroup.SelectedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn 1 nhóm dịch vụ.", IconType.Information);
                return;
            }

            DataRow            drServiceGroup = (dgServiceGroup.SelectedRows[0].DataBoundItem as DataRowView).Row;
            dlgAddServiceGroup dlg            = new dlgAddServiceGroup(drServiceGroup);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                drServiceGroup["Code"]        = dlg.ServiceGroup.Code;
                drServiceGroup["Name"]        = dlg.ServiceGroup.Name;
                drServiceGroup["Note"]        = dlg.ServiceGroup.Note;
                drServiceGroup["EnglishName"] = dlg.ServiceGroup.EnglishName;

                if (dlg.ServiceGroup.CreatedDate.HasValue)
                {
                    drServiceGroup["CreatedDate"] = dlg.ServiceGroup.CreatedDate;
                }

                if (dlg.ServiceGroup.CreatedBy.HasValue)
                {
                    drServiceGroup["CreatedBy"] = dlg.ServiceGroup.CreatedBy.ToString();
                }

                if (dlg.ServiceGroup.UpdatedDate.HasValue)
                {
                    drServiceGroup["UpdatedDate"] = dlg.ServiceGroup.UpdatedDate;
                }

                if (dlg.ServiceGroup.UpdatedBy.HasValue)
                {
                    drServiceGroup["UpdatedBy"] = dlg.ServiceGroup.UpdatedBy.ToString();
                }

                if (dlg.ServiceGroup.DeletedDate.HasValue)
                {
                    drServiceGroup["DeletedDate"] = dlg.ServiceGroup.DeletedDate;
                }

                if (dlg.ServiceGroup.DeletedBy.HasValue)
                {
                    drServiceGroup["DeletedBy"] = dlg.ServiceGroup.DeletedBy.ToString();
                }

                drServiceGroup["Status"] = dlg.ServiceGroup.Status;
            }
        }