protected override EntityBase CreateAndBuildEntity(DataHelper.Framework.SafeDataReader dr) { OFFICE theEntity = new OFFICE(); theEntity.PK_ID = !dr.IsDBNull(0) ? dr.GetValue(0).ToString() : string.Empty; theEntity.OFFICECODE = !dr.IsDBNull(1) ? dr.GetValue(1).ToString() : string.Empty; theEntity.OFFICENAME = !dr.IsDBNull(2) ? dr.GetValue(2).ToString() : string.Empty; theEntity.WARDNO = !dr.IsDBNull(3) ? dr.GetValue(3).ToString() : string.Empty; theEntity.STREET = !dr.IsDBNull(4) ? dr.GetValue(4).ToString() : string.Empty; theEntity.VDCMUNICIPALITY = !dr.IsDBNull(5) ? dr.GetValue(5).ToString() : string.Empty; theEntity.OFFICETYPEID = !dr.IsDBNull(6) ? dr.GetValue(6).ToString() : string.Empty; theEntity.WORKSASDEPOT = !dr.IsDBNull(7) ? dr.GetValue(7).ToString() : string.Empty; theEntity.REGIONID = !dr.IsDBNull(8) ? dr.GetValue(8).ToString() : string.Empty; theEntity.CONTACT_PERSON = !dr.IsDBNull(9) ? dr.GetValue(9).ToString() : string.Empty; theEntity.PHONE_NO = !dr.IsDBNull(10) ? dr.GetValue(10).ToString() : string.Empty; theEntity.MOBILE_NO = !dr.IsDBNull(11) ? dr.GetValue(11).ToString() : string.Empty; theEntity.EMAIL = !dr.IsDBNull(12) ? dr.GetValue(12).ToString() : string.Empty; return(theEntity); }
public ActionResult DeleteConfirmed(short id) { OFFICE office = db.OFFICEs.Find(id); db.OFFICEs.Remove(office); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Assign a new office /// </summary> /// <param name="office">The office to assign</param> /// <returns>True if office is added successfuly otherwise false</returns> public bool Addoffice(OFFICE office) { if (office != null) { db.OFFICEs.Add(office); db.SaveChanges(); return(true); } return(false); }
// // GET: /Office/Details/5 public ActionResult Details(short id = 0) { OFFICE office = db.OFFICEs.Find(id); if (office == null) { return(HttpNotFound()); } return(View(office)); }
public ActionResult Edit(OFFICE office) { if (ModelState.IsValid) { db.Entry(office).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.COUNTRYSLNO = new SelectList(db.COUNTRies, "COUNTRYSLNO", "COUNTRYCODE", office.COUNTRYSLNO); ViewBag.DESSLNO = new SelectList(db.DESIGNATIONs, "DESSLNO", "DESCODE", office.DESSLNO); ViewBag.DISTRICTSLNO = new SelectList(db.DISTRICTs, "DISTRICTSLNO", "DISTRICTNAME", office.DISTRICTSLNO); return(View(office)); }
// // GET: /Office/Edit/5 public ActionResult Edit(short id = 0) { OFFICE office = db.OFFICEs.Find(id); if (office == null) { return(HttpNotFound()); } ViewBag.COUNTRYSLNO = new SelectList(db.COUNTRies, "COUNTRYSLNO", "COUNTRYCODE", office.COUNTRYSLNO); ViewBag.DESSLNO = new SelectList(db.DESIGNATIONs, "DESSLNO", "DESCODE", office.DESSLNO); ViewBag.DISTRICTSLNO = new SelectList(db.DISTRICTs, "DISTRICTSLNO", "DISTRICTNAME", office.DISTRICTSLNO); return(View(office)); }
void DoWork(object sender, DoWorkEventArgs e) { CB_STATE cb_state = (CB_STATE)e.Argument; if (cb_state.vnc) { VNC vnc = new VNC(fileutils); Console.WriteLine("VNC安装中..."); vnc.install(); Console.WriteLine("VNC安装完成."); } if (cb_state.klite) { KLITE klite = new KLITE(fileutils); Console.WriteLine("K-Lite安装中..."); klite.install(); Console.WriteLine("K-Lite安装完成."); } if (cb_state.office) { OFFICE office = new OFFICE(fileutils); Console.WriteLine("MS Office安装中..."); office.install(); Console.WriteLine("MS Office安装完成."); } if (cb_state.uninstall != null) { foreach (INSTALLED item in lv_uninstalled.Items) { Console.WriteLine(item.name + "卸载中..."); progMgr.uninstall(item); //lv_uninstalled.Items.Remove(item); Console.WriteLine(item.name + "卸载完成."); } } }
protected override IDbDataParameter[] CreateSelectParameters(EntityBase anEntity) { OFFICE theEntity = (OFFICE)anEntity; List <IDbDataParameter> cmdParams = new List <IDbDataParameter>(); if (!string.IsNullOrEmpty(theEntity.PK_ID)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_PK_ID", theEntity.PK_ID)); } if (!string.IsNullOrEmpty(theEntity.OFFICECODE)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_OFFICECODE", theEntity.OFFICECODE)); } if (!string.IsNullOrEmpty(theEntity.OFFICENAME)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_OFFICENAME", theEntity.OFFICENAME)); } if (!string.IsNullOrEmpty(theEntity.WARDNO)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_WARDNO", theEntity.WARDNO)); } if (!string.IsNullOrEmpty(theEntity.STREET)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_STREET", theEntity.STREET)); } if (!string.IsNullOrEmpty(theEntity.VDCMUNICIPALITY)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_VDCMUNICIPALITY", theEntity.VDCMUNICIPALITY)); } if (!string.IsNullOrEmpty(theEntity.OFFICETYPEID)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_OFFICETYPEID", theEntity.OFFICETYPEID)); } if (!string.IsNullOrEmpty(theEntity.WORKSASDEPOT)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_WORKSASDEPOT", theEntity.WORKSASDEPOT)); } if (!string.IsNullOrEmpty(theEntity.REGIONID)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_REGIONID", theEntity.REGIONID)); } if (!string.IsNullOrEmpty(theEntity.CONTACT_PERSON)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_CONTACT_PERSON", theEntity.CONTACT_PERSON)); } if (!string.IsNullOrEmpty(theEntity.PHONE_NO)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_PHONE_NO", theEntity.PHONE_NO)); } if (!string.IsNullOrEmpty(theEntity.MOBILE_NO)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_MOBILE_NO", theEntity.MOBILE_NO)); } if (!string.IsNullOrEmpty(theEntity.EMAIL)) { cmdParams.Add(DataAccessFactory.CreateDataParameter("VAR_EMAIL", theEntity.EMAIL)); } cmdParams.Add(DataAccessFactory.CreateDataParameter("Result", "")); return(cmdParams.ToArray()); }
/// <summary> /// Edit an office assignment /// </summary> /// <param name="office">office object</param> public void Editoffice(OFFICE office) { //Change the state of the office object to modified, so it will be update in database db.Entry(office).State = EntityState.Modified; db.SaveChanges(); }