示例#1
0
        protected override void Delete()
        {
            HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    MessageFactory.BeginProc();
                    MessageFactory.Delete((HPS.BLL.MessageBLL.BLLMessage_TKeys)Key);
                    MessageFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString() + "='" + ((HPS.BLL.MessageBLL.BLLMessage_TKeys)Key).MessageID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageFactory.RollBackProc();
                throw ex;
            }
        }
示例#2
0
        private void FillCombo()
        {
            try
            {
                HPS.BLL.MessageBLL.BLLMessage_TFactory MessageID_bintFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();
                DataTable MessageID_bintDataTable = new DataTable();
                MessageID_bintFactory.GetAll(ref MessageID_bintDataTable);
                this.MessageID_bintComboBox.DisplayMember = HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageTitle_nvc.ToString();
                this.MessageID_bintComboBox.ValueMember   = HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString();
                this.MessageID_bintComboBox.DataSource    = MessageID_bintDataTable;
                this.MessageID_bintComboBox.SelectedIndex = -1;

                HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupID_intFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory();
                DataTable UserGroupID_intDataTable = new DataTable();
                UserGroupID_intFactory.GetAll(ref UserGroupID_intDataTable);
                this.UserGroupID_intComboBox.DisplayMember = HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroup_nvc.ToString();
                this.UserGroupID_intComboBox.ValueMember   = HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString();
                this.UserGroupID_intComboBox.DataSource    = UserGroupID_intDataTable;
                this.UserGroupID_intComboBox.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();

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


                HPS.BLL.MessageBLL.BLLMessage_TFactory Message_TFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();
                HPS.BLL.MessageBLL.BLLMessage_TKeys    MessageKey       = new HPS.BLL.MessageBLL.BLLMessage_TKeys();

                MessageKey.MessageID_bint = (Int64?)MessageGridView.CurrentRow.Cells["colMessageID_bint"].Value;
                MessageFactory.Delete(MessageKey);

                DataRow[] dr = ((DataTable)this.MessageGridView.DataSource).Select(HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString() + "='" + MessageKey.MessageID_bint.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.MessageGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
示例#4
0
 private void LoadMessage()
 {
     try
     {
         HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();
         DataTable MessageDataTable = new DataTable();
         MessageFactory.GetAll(ref MessageDataTable);
         this.MessageGridView.DataSource = MessageDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
示例#5
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();
     HPS.BLL.MessageBLL.BLLMessage_T        MessageEntity  = MessageFactory.GetBy((HPS.BLL.MessageBLL.BLLMessage_TKeys)Key);
     if (MessageEntity == null)
     {
         throw new HPS.Exceptions.MessageNotFound();
     }
     MessageTitle_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageEntity.MessageTitle_nvc, TypeCode.String).ToString();
     Message_nvcTextBox.Text      = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageEntity.Message_nvc, TypeCode.String).ToString();
     StartDate_nvcTextBox.Text    = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageEntity.StartDate_nvc, TypeCode.String).ToString();
     EndDate_nvcTextBox.Text      = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageEntity.EndDate_nvc, TypeCode.String).ToString();
     //    Visited_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(MessageEntity.Visited_bit, TypeCode.Boolean);
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref RecipientUserName_nvcComboBox, MessageEntity.RecipientUserName_nvc, TypeCode.String);
 }
示例#6
0
        protected override void Insert()
        {
            HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();
            try
            {
                HPS.BLL.MessageBLL.BLLMessage_T MessageEntity = new HPS.BLL.MessageBLL.BLLMessage_T();
                MessageEntity.MessageTitle_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageTitle_nvcTextBox.Text, TypeCode.String).ToString();
                MessageEntity.Message_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(Message_nvcTextBox.Text, TypeCode.String).ToString();
                MessageEntity.StartDate_nvc    = Hepsa.Core.Common.PersentationController.GetEntityValue(StartDate_nvcTextBox.Text, TypeCode.String).ToString();
                MessageEntity.EndDate_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(EndDate_nvcTextBox.Text, TypeCode.String).ToString();
                ///             MessageEntity.Visited_bit = Visited_bitCheckBox.Checked;
                MessageEntity.RecipientUserName_nvc = (String)Hepsa.Core.Common.PersentationController.GetEntityValue(RecipientUserName_nvcComboBox.SelectedValue, TypeCode.String);
                MessageEntity.UserName_nvc          = HPS.Common.CurrentUser.user.UserName_nvc;

                MessageEntity.Date_nvc = date.ConvertToPersianShortDate();
                MessageEntity.Time_nvc = date.Time;

                MessageFactory.BeginProc();
                MessageFactory.Insert(MessageEntity);
                MessageFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString()]        = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.MessageID_bint, TypeCode.Int64);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageTitle_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.MessageTitle_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Message_nvc.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Message_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.StartDate_nvc.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.StartDate_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.EndDate_nvc.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.EndDate_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Visited_bit.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Visited_bit, TypeCode.Boolean);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.RecipientUserName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.RecipientUserName_nvc, TypeCode.String);
                    dr["RecipientUserName_nvcUserName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(RecipientUserName_nvcComboBox);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Date_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Time_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Time_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.UserName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.UserName_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                MessageFactory.RollBackProc();
                throw ex;
            }
        }
示例#7
0
        protected override void Edit()
        {
            HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory();
            try
            {
                HPS.BLL.MessageBLL.BLLMessage_T MessageEntity = new HPS.BLL.MessageBLL.BLLMessage_T();
                MessageEntity.MessageTitle_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(MessageTitle_nvcTextBox.Text, TypeCode.String).ToString();
                MessageEntity.Message_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(Message_nvcTextBox.Text, TypeCode.String).ToString();
                MessageEntity.StartDate_nvc    = Hepsa.Core.Common.PersentationController.GetEntityValue(StartDate_nvcTextBox.Text, TypeCode.String).ToString();
                MessageEntity.EndDate_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(EndDate_nvcTextBox.Text, TypeCode.String).ToString();
                ////              MessageEntity.Visited_bit = Visited_bitCheckBox.Checked;
                MessageEntity.RecipientUserName_nvc = (String)Hepsa.Core.Common.PersentationController.GetEntityValue(RecipientUserName_nvcComboBox.SelectedValue, TypeCode.String);
                MessageEntity.Date_nvc     = date.MyDate.ToShortDateString();
                MessageEntity.Time_nvc     = date.Time;
                MessageEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    MessageFactory.BeginProc();
                    MessageFactory.Update(MessageEntity, (HPS.BLL.MessageBLL.BLLMessage_TKeys)Key);
                    MessageFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString() + "='" + ((HPS.BLL.MessageBLL.BLLMessage_TKeys)Key).MessageID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageTitle_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.MessageTitle_nvc, TypeCode.String);
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Message_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Message_nvc, TypeCode.String);
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.StartDate_nvc.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.StartDate_nvc, TypeCode.String);
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.EndDate_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.EndDate_nvc, TypeCode.String);
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Visited_bit.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Visited_bit, TypeCode.Boolean);
                            dr[0]["RecipientUserName_nvcUserName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(RecipientUserName_nvcComboBox);
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Date_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.Time_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageEntity.Time_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageFactory.RollBackProc();
                throw ex;
            }
        }