public Object BranchVideosPost([FromBody] BranchVideoInput bvv) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string country_Query = ""; PlanOutPut Pout = new PlanOutPut(); try { cnn.Open(); country_Query = "insert into BranchVideos(BranchCode,Videoname,VideoUrl,Video,CreatedBy,CreatedOn,IsDeleted,IsActive) values('" + bvv.BranchCode + "','" + bvv.Videoname + "','" + bvv.VideoUrl + "','" + bvv.Video + "','" + bvv.CreatedBy + "','" + ServerDateTime + "',0,1) SELECT @@IDENTITY;"; SqlCommand tm_cmd = new SqlCommand(country_Query, cnn); a = Convert.ToInt32(tm_cmd.ExecuteScalar()); Pout.status = "Success"; } catch (Exception ex) { Pout.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(Pout); return(sJSONResponse); }
public Object CityPost([FromBody] PlaceInput pi) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string country_Query = ""; PlanOutPut Pcity = new PlanOutPut(); try { cnn.Open(); country_Query = "insert into city(CityName,StatesId,IsDeleted,IsActive) values('" + pi.CityName + "'," + pi.StatesId + ",0,1) SELECT @@IDENTITY;"; SqlCommand tm_cmd = new SqlCommand(country_Query, cnn); a = Convert.ToInt32(tm_cmd.ExecuteScalar()); Pcity.status = "Success"; } catch (Exception ex) { Pcity.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(Pcity); return(sJSONResponse); }
public Object BranchImageUpdate([FromBody] BranchImageDetails bid) { string sJSONResponse = ""; SqlCommand command = cnn.CreateCommand(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); PlanOutPut Pout = new PlanOutPut(); string b = bid.Image; b = b.Substring(b.IndexOf(",") + 1); string PhotoUrl = GetPhotoUrl2(b, imgname() + 10001); try { cnn.Close(); cnn.Open(); SqlTransaction transaction; transaction = cnn.BeginTransaction("SampleTransaction"); command.Connection = cnn; command.Transaction = transaction; try { command.CommandText = "update BranchImages set ImageUrl='" + PhotoUrl + "',Image='" + bid.Image + "' where SNO=" + bid.ID + " "; command.ExecuteNonQuery(); transaction.Commit(); Pout.status = "Success"; } catch (Exception ex) { transaction.Rollback(); } finally { } } catch (Exception ec) { Pout.status = "fail"; } sJSONResponse = JsonConvert.SerializeObject(Pout); return(sJSONResponse); }
public Object CountryDelete([FromBody] PlaceInput pi) { string sJSONResponse = ""; SqlCommand command = cnn.CreateCommand(); PlanOutPut Pcountry = new PlanOutPut(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); try { cnn.Close(); cnn.Open(); SqlTransaction transaction; transaction = cnn.BeginTransaction("SampleTransaction"); command.Connection = cnn; command.Transaction = transaction; try { command.CommandText = "delete from Country where CountryId=" + pi.CountryId + " "; command.ExecuteNonQuery(); transaction.Commit(); Pcountry.status = "Success"; } catch (Exception ex) { transaction.Rollback(); } finally { } } catch (Exception ec) { Pcountry.status = "Fail"; } sJSONResponse = JsonConvert.SerializeObject(Pcountry); return(sJSONResponse); }
public Object BranchVideosDelete([FromBody] BranchVideosVideos bvv) { string sJSONResponse = ""; SqlCommand command = cnn.CreateCommand(); PlanOutPut Pout = new PlanOutPut(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); try { cnn.Close(); cnn.Open(); SqlTransaction transaction; transaction = cnn.BeginTransaction("SampleTransaction"); command.Connection = cnn; command.Transaction = transaction; try { command.CommandText = "delete from BranchVideos where SNO=" + bvv.SNO + " "; command.ExecuteNonQuery(); transaction.Commit(); Pout.status = "Success"; } catch (Exception ex) { transaction.Rollback(); } finally { } } catch (Exception ec) { Pout.status = "Success"; } sJSONResponse = JsonConvert.SerializeObject(Pout); return(sJSONResponse); }
public Object BranchImagePost([FromBody] BranchImageDetails bid) { string sJSONResponse = ""; DataTable dt_AppType = new DataTable(); string ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); int a = 0; string country_Query = ""; PlanOutPut Pout = new PlanOutPut(); string b = bid.Image; b = b.Substring(b.IndexOf(",") + 1); string PhotoUrl = GetPhotoUrl2(b, imgname() + 10001); try { cnn.Open(); country_Query = "insert into BranchImages(BranchCode,Imagename,Image,ImageUrl,CreatedBy,CreatedOn,IsDeleted,IsActive) values('" + bid.BranchCode + "','" + bid.Imagename + "','" + bid.Image + "','" + PhotoUrl + "','" + bid.CreatedBy + "','" + ServerDateTime + "',0,1) SELECT @@IDENTITY;"; SqlCommand tm_cmd = new SqlCommand(country_Query, cnn); a = Convert.ToInt32(tm_cmd.ExecuteScalar()); Pout.status = "Success"; } catch (Exception ex) { Pout.status = "Fail"; } finally { cnn.Close(); } sJSONResponse = JsonConvert.SerializeObject(Pout); return(sJSONResponse); }