Example #1
0
        public JobAndZ_Job(string jobname, List <JobDetail> jobdetail)
        {
            this.jobname_   = jobname;
            this.jobdetail_ = jobdetail;

            OleDbConnection connection = new OleDbConnection(Conection.getConectionString());

            try
            {
                string str_SQL = "SELECT j.job, j.AwnStyle , j.PanelPunch FROM Z_jobs j where j.job= '" + jobname + "'";

                connection.Open();

                OleDbCommand command = new OleDbCommand(str_SQL, connection);

                OleDbDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    String temp1 = "empty";
                    String temp2 = "empty";

                    if (reader["PanelPunch"].ToString() != "")
                    {
                        temp1 = reader["PanelPunch"].ToString();
                    }
                    if (reader["AwnStyle"].ToString() != "")
                    {
                        temp2 = reader["AwnStyle"].ToString();
                    }

                    this.panelpunch_ = temp1;
                    this.AwnStyle_   = temp2;
                }
            }
            catch (Exception exe)
            {
            }
            finally
            {
                connection.Close();
            }
        }
Example #2
0
        public Style()
        {
            this.styletable_ = new List <StyleDetail>();
            string          str_SQL    = "SELECT name,O1,O2,O3,O4,O5,O6,O7,O8 FROM styles ";
            OleDbConnection connection = new OleDbConnection(Conection.getConectionString());

            try
            {
                connection.Open();
                OleDbCommand    command = new OleDbCommand(str_SQL, connection);
                OleDbDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    if (reader["name"].ToString() != "")
                    {
                        StyleDetail temp = new StyleDetail();
                        temp.name_            = reader["name"].ToString();
                        temp.swingdoor_       = stylecounter(reader, "SW");
                        temp.awning_          = stylecounter(reader, "OV");
                        temp.shift_           = (stylecounter(reader, "HP") + stylecounter(reader, "HV") + stylecounter(reader, "HL") + stylecounter(reader, "HF") + stylecounter(reader, "HS"));
                        temp.r3_Andflushpanel = stylecounter(reader, "PP");
                        temp.spandrolSP_      = stylecounter(reader, "SP");
                        temp.spandrolSV_      = stylecounter(reader, "SV");
                        temp.shadowboxBV_     = stylecounter(reader, "BV");
                        temp.shadowboxSB_     = stylecounter(reader, "SB");
                        temp.projectpanel_    = stylecounter(reader, "FP");

                        styletable_.Add(temp);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally {
                connection.Close();
            }
        }
Example #3
0
        //get a table by considering the situation to take out all the floors who existis in the X_glazing
        public Job(string tablename)
        {
            OleDbConnection connection = new OleDbConnection(Conection.getConectionString());

            this.jobdetail_ = new List <JobDetail>();
            this.jobname_   = tablename;
            try
            {
                string str_SQL = "SELECT j.job, j.FLOOR , j.tag, j.style FROM [" + tablename + "]  j WHERE j.floor NOT IN (SELECT G.Floor FROM  X_GLAZING G where G.JOB = '" + tablename + "' and G.FirstComplete='TRUE' and o1 in ('1111','2222','3333') group by G.Floor ) ";

                connection.Open();

                OleDbCommand command = new OleDbCommand(str_SQL, connection);

                OleDbDataReader reader = command.ExecuteReader();


                while (reader.Read())
                {
                    if (reader["JOB"].ToString() != "" && reader["floor"].ToString() != "" && reader["tag"].ToString() != "")
                    {
                        jobdetail_.Add(new JobDetail()
                        {
                            floor = reader["floor"].ToString(), tag = reader["tag"].ToString(), style = reader["style"].ToString()
                        });
                    }
                }
            }
            catch (Exception exe)
            {
                jobname_   = "Error happend during reading the detail of the table in job class";
                jobdetail_ = null;
            }
            finally
            {
                connection.Close();
            }
        }
Example #4
0
        public Jobs()
        {
            //in the first part reading and taking out the good jobs happens
            //finaly all of the jobs that we need to check are in this variable
            List <string>   goodjobs   = new List <string>();
            OleDbConnection connection = new OleDbConnection(Conection.getConectionString());

            try
            {
                connection.Open();
                System.Data.DataTable dt = null;


                // Get the data table containing the schema
                dt = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

                List <Schemajobs> schemajobslist = new List <Schemajobs>();

                schemajobslist = (from DataRow dr in dt.Rows
                                  where dr["TABLE_NAME"].ToString().Length == 3
                                  select new Schemajobs()
                {
                    job_ = dr["TABLE_NAME"].ToString()
                }
                                  ).ToList();



                string str_SQL = "SELECT JOB FROM z_jobs where Completed = 0";

                OleDbCommand command = new OleDbCommand(str_SQL, connection);

                OleDbDataReader reader = command.ExecuteReader();

                //this is all the jobs from z_jobs
                List <string> xjobslist = new List <string>();

                while (reader.Read())
                {
                    xjobslist.Add(reader["JOB"].ToString());
                }



                foreach (string x in xjobslist)
                {
                    bool flag = false;

                    foreach (Schemajobs y in schemajobslist)
                    {
                        if (y.job_ == x)
                        {
                            flag = true;
                        }
                    }

                    if (flag)
                    {
                        goodjobs.Add(x);
                    }
                }
            }

            catch (Exception ex)
            {
                goodjobs.Add("Error happend during reading the schema jobs and comparing to Z_jobs");
            }
            finally
            {
                connection.Close();
            }

            this.allofthejobtables_ = new List <Job>();
            foreach (string onejob in goodjobs)
            {
                this.allofthejobtables_.Add(new Job(onejob));
            }
        }
Example #5
0
        public static List <Job> getAllJobTables()
        {
            try
            {
                OleDbConnection connection = new OleDbConnection(Conection.getConectionString());
                connection.Open();
                System.Data.DataTable dt = null;


                // Get the data table containing the schema
                dt = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);



                List <Schemajobs> schemajobslist = new List <Schemajobs>();

                schemajobslist = (from DataRow dr in dt.Rows
                                  where dr["TABLE_NAME"].ToString().Length == 3
                                  select new Schemajobs()
                {
                    job_ = dr["TABLE_NAME"].ToString()
                }
                                  ).ToList();



                string str_SQL = "SELECT JOB FROM z_jobs where Completed = 0";

                OleDbCommand command = new OleDbCommand(str_SQL, connection);

                OleDbDataReader reader = command.ExecuteReader();

                //this is all the jobs from z_jobs
                List <string> xjobslist = new List <string>();

                while (reader.Read())
                {
                    xjobslist.Add(reader["JOB"].ToString());
                }

                //finaly all of the jobs that we need to check are in this variable
                List <string> goodjobs = new List <string>();

                foreach (string x in xjobslist)
                {
                    bool flag = false;

                    foreach (Schemajobs y in schemajobslist)
                    {
                        if (y.job_ == x)
                        {
                            flag = true;
                        }
                    }

                    if (flag)
                    {
                        goodjobs.Add(x);
                    }
                }



                List <Job> data = new List <Job>();

                //foreach (string onejob in goodjobs)
                //{
                //    Job job = new Job();
                //    if (job.getJobsExcludedFromGlazing(onejob).Count() != 0)
                //    {
                //        foreach (Job elm in job.getJobsExcludedFromGlazing(onejob))
                //        {
                //            data.Add(elm);
                //        }
                //    }
                //}

                return(data);
            }

            catch (Exception ex)
            {
                List <Job> data = new List <Job>();
                //data.Add(new Job() { job = ex.ToString() });
                return(data);
            }
        }