public BlockOrganization Update(BlockOrganization BLO, string userid) { var sqlQuery = string.Format(@"UPDATE BLOCKORGANIZATION SET IDBLOCKORGANIZATION = '{0}', BLOCKORGANIZATIONNAME = '{1}', COMPANYSITE = '{2}', UPDATEBY = {3}, UPDATEDATE = '{4}' WHERE SID = {5}", BLO.IDBLOCKORGANIZATION, BLO.BLOCKORGANIZATIONNAME, BLO.COMPANYSITE, Convert.ToInt32(userid), DateTime.Now, BLO.SID); this._db.Execute(sqlQuery, BLO); return(BLO); }
public BlockOrganization Add(BlockOrganization BLO, string userid) { var sqlQuery = @"INSERT INTO BLOCKORGANIZATION (IDBLOCKORGANIZATION, BLOCKORGANIZATIONNAME, COMPANYSITE, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE) VALUES ('" + BLO.IDBLOCKORGANIZATION + @"', '" + BLO.BLOCKORGANIZATIONNAME + "', '" + BLO.COMPANYSITE + "', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"'); " + "SELECT CAST(SCOPE_IDENTITY() as int)"; var SID = _db.Query <int>(sqlQuery, BLO).Single(); BLO.SID = SID; return(BLO); }
public JsonResult Edit(BlockOrganization blockorganization, string userid) { try { if (ModelState.IsValid) { blockorganization.COMPANYSITE = int.Parse(Session["companysite"].ToString()); BLO.Update(blockorganization, Session["userid"].ToString()); } } catch { return(Json("error")); } return(Json("success")); }