コード例 #1
0
        private void BuildGridDoiTuong()
        {
            this.Cursor = Cursors.Wait;
            try
            {
                lstDoiTuong = new List <SYS_JOB_SUBSCRIBE>();

                bool   ret          = false;
                string sMessage     = "";
                string loaiDoiTuong = "";

                if (tvwTree.SelectedItem != null)
                {
                    if (((RadTreeViewItem)tvwTree.SelectedItem).Tag != null)
                    {
                        loaiDoiTuong = ((RadTreeViewItem)tvwTree.SelectedItem).Tag.ToString();
                    }
                }

                ret = job.SysJobSubscribe(DatabaseConstant.Action.LAY_LAI, ref loaiDoiTuong, ref doiTuong, ref lstDoiTuong, ref sMessage);
                updateContextMenu();


                // Tạo source thông tin đối tượng
                dt = new DataTable();
                dt.Columns.Add("ID", typeof(int));
                dt.Columns.Add("Order", typeof(int));
                dt.Columns.Add("Name", typeof(string));
                dt.Columns.Add("Email", typeof(string));
                dt.Columns.Add("Status", typeof(string));

                int stt = 0;
                // Lấy dữ liệu đổ vào source với loại đối tượng tương ứng
                foreach (var item in lstDoiTuong)
                {
                    DataRow r = dt.NewRow();
                    stt  = stt + 1;
                    r[0] = item.ID;
                    r[1] = stt;
                    r[2] = item.SUB_NAME;
                    r[3] = item.SUB_EMAIL;
                    r[4] = item.SUB_STATUS;
                    dt.Rows.Add(r);
                }

                // đổ source lên lưới
                grDanhSach.ItemsSource = dt.DefaultView;
                lblSumNNSD.Content     = dt.Rows.Count;
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
コード例 #2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Validation())
                {
                    SYS_JOB_SUBSCRIBE        obj         = new SYS_JOB_SUBSCRIBE();
                    List <SYS_JOB_SUBSCRIBE> lstDoiTuong = new List <SYS_JOB_SUBSCRIBE>();
                    GetFormData(ref obj);

                    JobProcess process  = new JobProcess();
                    bool       ret      = false;
                    string     sMessage = "";

                    ret = process.SysJobSubscribe(DatabaseConstant.Action.CAU_HINH, ref loaiDoiTuong, ref obj, ref lstDoiTuong, ref sMessage);

                    if (ret)
                    {
                        LMessage.ShowMessage("Insert/Update successfull", LMessage.MessageBoxType.Warning);
                        return;
                    }
                    else
                    {
                        LMessage.ShowMessage("Insert/Update failed", LMessage.MessageBoxType.Warning);
                        return;
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
コード例 #3
0
        private void SetFormData()
        {
            try
            {
                SYS_JOB_SUBSCRIBE        obj         = new SYS_JOB_SUBSCRIBE();
                List <SYS_JOB_SUBSCRIBE> lstDoiTuong = new List <SYS_JOB_SUBSCRIBE>();
                obj.ID = id;

                JobProcess process  = new JobProcess();
                bool       ret      = false;
                string     sMessage = "";

                ret = process.SysJobSubscribe(DatabaseConstant.Action.LOAD, ref loaiDoiTuong, ref obj, ref lstDoiTuong, ref sMessage);

                if (obj != null)
                {
                    txtName.Text        = obj.SUB_NAME;
                    txtDescription.Text = obj.DESCRIPTION;
                    txtEmail.Text       = obj.SUB_EMAIL;
                    bool status = obj.SUB_STATUS.Equals("DEACTIVE") ? true : false;
                    chkStatusDeactive.IsChecked = status;
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
                throw ex;
            }
        }