Example #1
0
        static public String[] FindCred(String ID)
        {
            String[]      result     = new String[6];
            String        connString = Properties.Settings.Default.HQ;
            DataTable     dt1        = new DataTable();
            DataTable     dt2        = new DataTable();
            SqlConnection con        = new SqlConnection(connString);

            con.Open();
            SqlCommand     command1 = new SqlCommand("SELECT * FROM Franchisee  WHERE franchisee_id = " + ID, con);
            SqlDataAdapter adap1    = new SqlDataAdapter(command1);

            adap1.Fill(dt1);

            SqlCommand     command2 = new SqlCommand("SELECT * FROM Operational_Region  WHERE zone_id = " + dt1.Rows[0]["zone_id"].ToString(), con);
            SqlDataAdapter adap2    = new SqlDataAdapter(command2);

            adap2.Fill(dt2);
            con.Close();

            result[0] = dt1.Rows[0]["company_name"].ToString();
            result[1] = dt1.Rows[0]["isHQ"].ToString();
            result[2] = dt2.Rows[0]["zone_title"].ToString();
            result[3] = MCountry.GetName(dt2.Rows[0]["country_id"].ToString());
            result[4] = MProvState.GetName(dt2.Rows[0]["province_id"].ToString());
            result[5] = MCity.GetName(dt2.Rows[0]["city_id"].ToString());


            return(result);
        }
Example #2
0
        public void LoadOpRegions()
        {
            DataTable dt   = MOpReg.GetRegions();
            DataTable regs = new DataTable();

            regs.Columns.Add("ID", typeof(string));
            regs.Columns.Add("Display", typeof(string));

            regs.Rows.Add(new String[] { "NULL", "<All>" });
            foreach (DataRow r in dt.Rows)
            {
                regs.Rows.Add(r["zone_id"].ToString(), r["zone_Title"].ToString() + " ( "
                              + MCity.GetName(r["city_id"].ToString()) + ", "
                              + MProvState.GetName(r["province_id"].ToString()) + ", "
                              + MCountry.GetName(r["country_id"].ToString()) + ")");
            }

            OpRegionCombo.DataSource    = regs;
            OpRegionCombo.ValueMember   = regs.Columns["ID"].ToString();
            OpRegionCombo.DisplayMember = regs.Columns["Display"].ToString();
            OpRegionCombo.SelectedValue = "NULL";
        }