public static CommonObjects[] GetCity(string ProvinceId)
 {
     Vendors objVendors=new Vendors();
     DataTable dtCity = objVendors.GetCityForProvince(ProvinceId);
     DataRow newRowCity = dtCity.NewRow();
     newRowCity["alias"] = "-1";
     newRowCity["nama_kota"] = "-City-";
     dtCity.Rows.InsertAt(newRowCity, 0);
     dtCity.AcceptChanges();
     CommonObjects[] objCity = new CommonObjects[dtCity.Rows.Count];
     int intCount = 0;
     foreach (DataRow drw in dtCity.Rows)
     {
         objCity[intCount] = new CommonObjects();
         objCity[intCount].Value = drw["alias"].ToString();
         objCity[intCount].Text = drw["nama_kota"].ToString();
         objCity[intCount].DefaultValue = objCity[0].Value;
         intCount++;
     }
     return objCity;
 }
        public static VendorDetail GetVendorData(int VendorId)
        {
            VendorDetail objVendorDetail = new VendorDetail();
            Vendors objVendors = new Vendors();
            DataTable objmainDT = new DataTable();
            DataRow[] objMainRow = null;
            if (VendorId != 0)
            {
                objmainDT = (DataTable)HttpContext.Current.Session["VendorData"];
                objMainRow = objmainDT.Select("id=" + VendorId);
            }
            DataTable dtProvince = new DataTable();
            dtProvince = objVendors.GetProvince();
            DataRow newRowProvince = dtProvince.NewRow();
            newRowProvince["ID"] = "-1";
            newRowProvince["Alias"] = "-1";
            newRowProvince["nama_daerah"] = "-Province-";
            dtProvince.Rows.InsertAt(newRowProvince, 0);
            dtProvince.AcceptChanges();
            objVendorDetail.Province = new CommonObjects[dtProvince.Rows.Count];
            int intCount=0;
            foreach (DataRow drw in dtProvince.Rows)
            {
                objVendorDetail.Province[intCount] = new CommonObjects();
                objVendorDetail.Province[intCount].Value = drw["Alias"].ToString();
                objVendorDetail.Province[intCount].Text = drw["nama_daerah"].ToString();
                objVendorDetail.Province[intCount].DefaultValue = VendorId != 0 ? objMainRow[0]["alias_daerah"].ToString() : objVendorDetail.Province[0].Value;
                intCount++;
            }

            DataTable dtCity = new DataTable();
            dtCity = objVendors.GetCityForProvince(objVendorDetail.Province[0].DefaultValue);
            DataRow newRowCity = dtCity.NewRow();
            newRowCity["alias"] = "-1";
            newRowCity["nama_kota"] = "-City-";
            dtCity.Rows.InsertAt(newRowCity, 0);
            dtCity.AcceptChanges();
            objVendorDetail.City = new CommonObjects[dtCity.Rows.Count];
            intCount = 0;
            foreach (DataRow drw in dtCity.Rows)
            {
                objVendorDetail.City[intCount] = new CommonObjects();
                objVendorDetail.City[intCount].Value = drw["alias"].ToString();
                objVendorDetail.City[intCount].Text = drw["nama_kota"].ToString();
                objVendorDetail.City[intCount].DefaultValue = VendorId != 0 ? objMainRow[0]["alias_kota"].ToString() : objVendorDetail.City[0].Value;
                intCount++;
            }

            objVendorDetail.VendorsName = VendorId != 0 ? objMainRow[0]["nama_vendors"].ToString() : "";
            objVendorDetail.VendorsAlias = VendorId != 0 ? objMainRow[0]["alias_vendors"].ToString() : "";
            objVendorDetail.VendorsAddress = VendorId != 0 ? objMainRow[0]["alias_vendors"].ToString() : "";
            objVendorDetail.Phone = VendorId != 0 ? objMainRow[0]["tlp_vendors"].ToString() : "";
            objVendorDetail.Email = VendorId != 0 ? objMainRow[0]["email_vendors"].ToString() : "";
            objVendorDetail.ImageUrl = VendorId != 0 ? "../"+objMainRow[0]["logo_vendors"].ToString() : "";
            objVendorDetail.BannerUrl = VendorId != 0 ? "../"+objMainRow[0]["banner_vendors"].ToString() : "";
            return objVendorDetail;
        }