Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            try
            {
                PreviewDTO obj = new PreviewDTO();
                obj.IDHouse     = Convert.ToInt64((cboHouse.SelectedItem as clsComboItem).Value);
                obj.IDCustomer  = Convert.ToInt64((cboCustomer.SelectedItem as clsComboItem).Value);
                obj.PreviewDate = dtpPreviewDate.Value.Date;
                obj.Comment     = txtComment.Text;

                ds = PreviewDAO.Preview_InsUpd(obj);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]) == 1)
                {
                    clsMessages.ShowInformation("Thêm thành công!");
                    frmParent.LoadDataToForm();
                    this.Close();
                }
                else
                {
                    clsMessages.ShowWarning("Thêm thất bại!");
                }
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            finally
            {
                ds.Dispose();
            }
        }
        public object Get(string showCode, string entityId)
        {
            PreviewDTO    pDTO  = new PreviewDTO();
            SQLDataHelper SQLDA = new SQLDataHelper();

            eventBitEntities entities = new eventBitEntities();

            var entityState = entities.EntityStates.FirstOrDefault(x => x.ShowCode == showCode && x.EntityID == entityId);

            DataTable dt = new DataTable();

            if (entityState != null)
            {
                dt = SQLDA.GetEntityDataTable(entityId, (entityState.sysEventId ?? 0));

                pDTO.Columns = dt.Columns.Cast <DataColumn>().Where(x => !x.ColumnName.StartsWith("sys"))
                               .Select(x => Char.ToLowerInvariant(x.ColumnName[0]) + x.ColumnName.Substring(1))
                               .ToArray();

                pDTO.SysRowStampNumMax = entityState.sysRowStampNumMax.ToString();

                pDTO.RowCount = SQLDA.GetRowCountForEntity(entityId, (entityState.sysEventId ?? 0));
            }

            pDTO.Data = dt;

            return(pDTO);
        }
Beispiel #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            try
            {
                PreviewDTO obj = new PreviewDTO();
                obj.IDHouse     = Convert.ToInt64((cboHouse.SelectedItem as clsComboItem).Value);
                obj.IDCustomer  = Convert.ToInt64((cboCustomer.SelectedItem as clsComboItem).Value);
                obj.PreviewDate = dtpPreviewDate.Value.Date;

                ds = PreviewDAO.Preview_Search(obj);
                if (ds != null && ds.Tables.Count > 0)
                {
                    dgvPreview.DataSource = ds.Tables[0].Copy();
                }
                else
                {
                    clsMessages.ShowWarning("Không tìm thấy");
                }
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            finally
            {
                ds.Dispose();
            }
        }
Beispiel #4
0
 public HttpResponseMessage PreviewUrl(PreviewDTO postData)
 {
     try
     {
         var link = Utilities.GetLinkData(postData.Url);
         return(Request.CreateResponse(HttpStatusCode.OK, link));
     }
     catch (Exception exc)
     {
         Logger.Error(exc);
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc));
     }
 }
Beispiel #5
0
        public static DataSet Preview_Del(PreviewDTO _Preview)
        {
            DataSet ds = new DataSet();

            try
            {
                ds = clsDatabaseExecute.ExecuteDatasetSP("Preview_Del", _Preview.IDCustomer, _Preview.IDHouse, _Preview.PreviewDate.ToString("dd/MM/yyyy"));
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            return(ds);
        }
Beispiel #6
0
        public static DataSet Preview_InsUpd(PreviewDTO _Preview)
        {
            DataSet ds = new DataSet();

            try
            {
                ds = clsDatabaseExecute.ExecuteDatasetSP("Preview_InsUpd", _Preview.IDCustomer, _Preview.IDHouse, _Preview.Comment);
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            return(ds);
        }
Beispiel #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            try
            {
                if (string.IsNullOrWhiteSpace(cboCustomer.Text) || string.IsNullOrWhiteSpace(cboHouse.Text))
                {
                    clsMessages.ShowInformation("Vui lòng chọn dòng dữ liệu muốn sửa!");
                    return;
                }

                PreviewDTO obj = new PreviewDTO();
                obj.IDHouse     = Convert.ToInt64((cboHouse.SelectedItem as clsComboItem).Value);
                obj.IDCustomer  = Convert.ToInt64((cboCustomer.SelectedItem as clsComboItem).Value);
                obj.PreviewDate = dtpPreviewDate.Value.Date;
                obj.Comment     = txtComment.Text;

                ds = PreviewDAO.Preview_InsUpd(obj);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]) == 1)
                {
                    clsMessages.ShowInformation("Cập nhật thành công!");
                    LoadDataToForm();
                }
                else
                {
                    clsMessages.ShowWarning("Cập nhật thất bại!");
                }
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            finally
            {
                ds.Dispose();
            }
        }
 public HttpResponseMessage PreviewUrl(PreviewDTO postData)
 {
     try
     {
         var link = Utilities.GetLinkData(postData.Url);
         return Request.CreateResponse(HttpStatusCode.OK, link);
     }
     catch (Exception exc)
     {
         Logger.Error(exc);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
     }
 }