示例#1
0
 public AddInstansiViewModel(Instansi instansi)
 {
     Load();
     this.Id          = instansi.Id;
     this.Name        = instansi.Name;
     this.DistrikName = instansi.DistrikName;
     this.Kategori    = instansi.Kategori;
     this.Kecamatan   = instansi.Kecamatan;
     this.Alamat      = instansi.Alamat;
 }
示例#2
0
        private Task ProccessInstasi()
        {
            try
            {
                var rngPengaduan = excel.GetRange("Instansi", "A3:D100");

                for (var row = 3; row <= rngPengaduan.Count; row++)
                {
                    Instansi instansi = new Instansi();
                    var      nama     = rngPengaduan.Cell(row, "A");
                    if (string.IsNullOrEmpty(nama))
                    {
                        break;
                    }
                    instansi.Name = nama;

                    /* KategoriInstansi kategori;
                     * var success = Enum.TryParse<KategoriInstansi>(rngPengaduan.Cell(row, "B"), out kategori);
                     * if (!success)
                     *   break;
                     * instansi.Kategori = kategori;
                     *
                     *
                     * TingakatInstansi tingkat;
                     * success = Enum.TryParse<TingakatInstansi>(rngPengaduan.Cell(row, "C"), out tingkat);
                     * if (!success)
                     *   break;
                     *
                     * instansi.Tingkat = tingkat;
                     * instansi.Alamat = rngPengaduan.Cell(row, "D");*/

                    var isFound = DataAccess.DataBasic.DataInstansi.Where(x => x.Name.ToLower() == nama.ToLower()).FirstOrDefault();
                    if (isFound == null)
                    {
                        DataAccess.DataBasic.DataInstansi.Add(instansi);
                    }
                }

                return(Task.FromResult(0));
            }
            catch (Exception)
            {
                throw new SystemException("Format Template Salah, Hubungi Admin");
            }
        }