コード例 #1
0
        protected override void Delete()
        {
            HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    NewsFactory.BeginProc();
                    NewsFactory.Delete((HPS.BLL.NewsBLL.BLLNews_TKeys)Key);
                    NewsFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.NewsBLL.BLLNews_T.News_TField.NewsID_bint.ToString() + "='" + ((HPS.BLL.NewsBLL.BLLNews_TKeys)Key).NewsID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                NewsFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.NewsBLL.BLLNews_TFactory News_TFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();
                HPS.BLL.NewsBLL.BLLNews_TKeys    NewsKey       = new HPS.BLL.NewsBLL.BLLNews_TKeys();

                NewsKey.NewsID_bint = (Int64?)NewsGridView.CurrentRow.Cells["colNewsID_bint"].Value;
                NewsFactory.Delete(NewsKey);

                DataRow[] dr = ((DataTable)this.NewsGridView.DataSource).Select(HPS.BLL.NewsBLL.BLLNews_T.News_TField.NewsID_bint.ToString() + "='" + NewsKey.NewsID_bint.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.NewsGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #3
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();
     HPS.BLL.NewsBLL.BLLNews_T        NewsEntity  = NewsFactory.GetBy((HPS.BLL.NewsBLL.BLLNews_TKeys)Key);
     if (NewsEntity == null)
     {
         throw new HPS.Exceptions.NewsNotFound();
     }
     Title_nvcTextBox.Text     = Hepsa.Core.Common.PersentationController.GetEntityValue(NewsEntity.Title_nvc, TypeCode.String).ToString();
     News_nvcTextBox.Text      = Hepsa.Core.Common.PersentationController.GetEntityValue(NewsEntity.News_nvc, TypeCode.String).ToString();
     StartDate_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(NewsEntity.StartDate_nvc, TypeCode.String).ToString();
     EndDate_nvcTextBox.Text   = Hepsa.Core.Common.PersentationController.GetEntityValue(NewsEntity.EndDate_nvc, TypeCode.String).ToString();
 }
コード例 #4
0
 private void LoadNews()
 {
     try
     {
         HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();
         DataTable NewsDataTable = new DataTable();
         NewsFactory.GetAll(ref NewsDataTable);
         this.NewsGridView.DataSource = NewsDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
        protected override void Insert()
        {
            HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();
            try
            {
                HPS.BLL.NewsBLL.BLLNews_T NewsEntity = new HPS.BLL.NewsBLL.BLLNews_T();
                NewsEntity.Title_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Title_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.News_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(News_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.StartDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(StartDate_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.EndDate_nvc   = Hepsa.Core.Common.PersentationController.GetEntityValue(EndDate_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.Date_nvc      = NewsFactory.ServerJalaliDate;
                NewsEntity.Time_nvc      = NewsFactory.ServerTime;
                NewsEntity.UserName_nvc  = HPS.Common.CurrentUser.user.UserName_nvc;
                if (NewsFactory.ServerJalaliDate.CompareTo(StartDate_nvcTextBox.Text) > 0)
                {
                    throw new ApplicationException("از تاریخ نباید کوچکتر از <" + NewsFactory.ServerJalaliDate + "> باشد");
                }
                if (EndDate_nvcTextBox.Text.CompareTo(StartDate_nvcTextBox.Text) < 0)
                {
                    throw new ApplicationException(HPS.Exceptions.ExceptionCs.EndDateMoreThanStartDate);
                }
                NewsFactory.BeginProc();
                NewsFactory.Insert(NewsEntity);
                NewsFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.NewsID_bint.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.NewsID_bint, TypeCode.Int64);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.Title_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.Title_nvc, TypeCode.String);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.News_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.News_nvc, TypeCode.String);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.StartDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.StartDate_nvc, TypeCode.String);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.EndDate_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.EndDate_nvc, TypeCode.String);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.Date_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.Time_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.Time_nvc, TypeCode.String);
                    dr[HPS.BLL.NewsBLL.BLLNews_T.News_TField.UserName_nvc.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.UserName_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                NewsFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #6
0
        protected override void Edit()
        {
            HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();
            try
            {
                HPS.BLL.NewsBLL.BLLNews_T NewsEntity = new HPS.BLL.NewsBLL.BLLNews_T();
                NewsEntity.Title_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Title_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.News_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(News_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.StartDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(StartDate_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.EndDate_nvc   = Hepsa.Core.Common.PersentationController.GetEntityValue(EndDate_nvcTextBox.Text, TypeCode.String).ToString();
                NewsEntity.Date_nvc      = NewsFactory.ServerJalaliDate;
                NewsEntity.Time_nvc      = NewsFactory.ServerTime;
                NewsEntity.UserName_nvc  = HPS.Common.CurrentUser.user.UserName_nvc;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    NewsFactory.BeginProc();
                    NewsFactory.Update(NewsEntity, (HPS.BLL.NewsBLL.BLLNews_TKeys)Key);
                    NewsFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.NewsBLL.BLLNews_T.News_TField.NewsID_bint.ToString() + "='" + ((HPS.BLL.NewsBLL.BLLNews_TKeys)Key).NewsID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.NewsBLL.BLLNews_T.News_TField.Title_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.Title_nvc, TypeCode.String);
                            dr[0][HPS.BLL.NewsBLL.BLLNews_T.News_TField.News_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.News_nvc, TypeCode.String);
                            dr[0][HPS.BLL.NewsBLL.BLLNews_T.News_TField.StartDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.StartDate_nvc, TypeCode.String);
                            dr[0][HPS.BLL.NewsBLL.BLLNews_T.News_TField.EndDate_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.EndDate_nvc, TypeCode.String);
                            dr[0][HPS.BLL.NewsBLL.BLLNews_T.News_TField.Date_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.NewsBLL.BLLNews_T.News_TField.Time_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(NewsEntity.Time_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                NewsFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #7
0
        private void LoadGrids()
        {
            HPS.BLL.TrafficBLL.BLLTraffic_TFactory DriverFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            DataTable DriverDataTable = new DataTable();
            string    Conditioin      = string.Empty;

            DriverFactory.SelectDriverMobile_nvc(Conditioin, ref DriverDataTable);
            DriverDataTable.Columns.Add(new DataColumn("Checked_bit", Type.GetType("System.Boolean")));
            DriverDataTable.Columns["Checked_bit"].AllowDBNull  = true;
            DriverDataTable.Columns["Checked_bit"].DefaultValue = false;
            this.DriversdataGridView.AutoGenerateColumns        = false;
            this.DriversdataGridView.DataSource = DriverDataTable;

            HPS.BLL.NewsBLL.BLLNews_TFactory NewsFactory = new HPS.BLL.NewsBLL.BLLNews_TFactory();
            DataTable NewsDataTable = new DataTable();

            NewsFactory.GetAllByCondition(string.Format("[News_T].[StartDate_nvc] <= '{0}' And [News_T].[EndDate_nvc] >= '{0}'", NewsFactory.ServerJalaliDate.ToString()), ref NewsDataTable);
            NewsDataTable.Columns.Add(new DataColumn("Checked_bit", Type.GetType("System.Boolean")));
            NewsDataTable.Columns["Checked_bit"].AllowDBNull  = true;
            NewsDataTable.Columns["Checked_bit"].DefaultValue = false;
            this.NewsdataGridView.AutoGenerateColumns         = false;
            this.NewsdataGridView.DataSource = NewsDataTable;
        }