Example #1
0
        public DBChanges(StagesDeliverables deliverables,string jAcr)
        {
            var queries = new StringBuilder();
            JournalAcronym = jAcr;
            DeliveryPackage = deliverables;

            queries.AppendLine(@"UPDATE  `tbldeliverablesdetails` AS a
                                LEFT JOIN `tbldeliverables` AS b ON a.`DeliverableId` = b.`id`
                                LEFT JOIN `tblstages` AS c ON a.`StageId` = c.`id`
                                LEFT JOIN `tbljournalinformations` AS d ON a.`JournalId` = d.`id`
                                SET     a.`Value` = 'N'
                                WHERE   c.`Stage`='Article' AND b.`Deliverables`='PDF' AND d.`Acronym`=@Acronym;");
            queries.AppendLine(@"UPDATE  `tbldeliverablesdetails` AS a
                                LEFT JOIN `tbldeliverables` AS b ON a.`DeliverableId` = b.`id`
                                LEFT JOIN `tblstages` AS c ON a.`StageId` = c.`id`
                                LEFT JOIN `tbljournalinformations` AS d ON a.`JournalId` = d.`id`
                                SET     a.`Value` = 'N'
                                WHERE   c.`Stage`='Article' AND b.`Deliverables`='Proof' AND d.`Acronym`=@Acronym;");

            using (var dbhand = new DBHandlder() { ConnectionString = ConfigurationManager.ConnectionStrings["IEEE"].ConnectionString })
            {
                var mParams = new []
                {
                    new MySqlParameter("@Acronym",jAcr)
                };
                dbhand.Query = queries.ToString();
                dbhand.ExecuteTransation(mParams);
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            var connectionString = ConfigurationManager.ConnectionStrings["IEEE"].ConnectionString;

            using (var dbHand = new DBHandlder() { ConnectionString = connectionString })
            {
                #region Query for Journal Deliverables Details
                dbHand.Query = @"SELECT 	a.`Value`,
                                    b.`Deliverables`,
                                    c.`Stage`,
                                    d.`Acronym`
                                FROM `tbldeliverablesdetails` AS a
                                LEFT JOIN `tbldeliverables` AS b ON a.`DeliverableId` = b.`id`
                                LEFT JOIN `tblstages` AS c ON a.`StageId` = c.`id`
                                LEFT JOIN `tbljournalinformations` AS d ON a.`JournalId` = d.`id`;";

                #endregion
                var jD = dbHand.GetData().AsEnumerable();

                #region Query for Journal Paths
                dbHand.Query = @"SELECT 	b.`Path`,
                                            c.`Stage`,
                                            a.`Path` AS 'Path Lookup',
                                            d.`Acronym`
                                        FROM `tbljournaldirectories` AS a
                                        LEFT JOIN `tbldirectories` AS b ON a.`DirectoryId` = b.`id`
                                        LEFT JOIN `tblstages` AS c ON a.`StageId` = c.`id`
                                        LEFT JOIN `tbljournalinformations` AS d ON a.`JournalId` = d.`id`;";

                #endregion
                var jP = dbHand.GetData().AsEnumerable();

                #region Query for JournalInformation
                dbHand.Query = @"SELECT
                                    a.*,
                                    c.`Lastname`,
                                    c.`Firstname`,
                                    c.`Email`

                                FROM  `tbljournalinformations` AS a
                                LEFT JOIN `tbljournaleditor` AS b ON a.id = b.`JournalId`
                                LEFT JOIN `tbleditor` AS c ON b.`EditorId` = c.`id`;";
                #endregion
                var jI = dbHand.GetData().AsEnumerable();
                UIViewModel = new ViewModel(jD, jP, jI);

                dbHand.Query = @"SELECT * FROM `tblEditor`;";
                UIViewModel.EditorList = (from edits in dbHand.GetData().AsEnumerable()
                                          select new JournalEditors()
                                          {
                                              Lastname = edits["Lastname"].ToString(),
                                              Firstname = edits["Firstname"].ToString(),
                                              Email = edits["Email"].ToString()
                                          }).ToList();
                this.DataContext = UIViewModel;
            };
        }
Example #3
0
 private void dTimerTick(object sender, EventArgs e)
 {
     var connectionString = ConfigurationManager.ConnectionStrings["IEEE"].ConnectionString;
     using (var dbHand = new DBHandlder() { ConnectionString = connectionString })
     {
         if (dbHand.CheckConnection())
         {
             new MainWindow().Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Can't Connect with the database... Please check Database Connection...");
             this.Close();
         }
     }
 }