public static List <_IayForm> GetIayReports() { MySqlConnection scon = new MySqlConnection(WebConfigurationManager.ConnectionStrings["LocalMySqlServer"].ConnectionString); MySqlCommand scmd = new MySqlCommand(); scon.Open(); scmd.Connection = scon; List <_IayForm> repList = new List <_IayForm>(); try { scmd.CommandText = "SELECT a.*,d.*,b.*,p.*,bf.* FROM iayreports a INNER JOIN benefs bf ON a.bfid=bf.bfid INNER JOIN panchayats p ON bf.pid=p.pid INNER JOIN blocks b ON p.bid=b.bid INNER JOIN districts d ON b.did=d.did"; scmd.Prepare(); MySqlDataReader sdr = scmd.ExecuteReader(); if (sdr.HasRows) { while (sdr.Read()) { _IayForm iaydata = new _IayForm(); iaydata.FDATE = Convert.ToDateTime(sdr.GetString("fdate")).ToString("dd-MMM-yyyy hh:mm"); iaydata.DISTRICT.DID = Convert.ToInt32(sdr.GetString("did")); repList.Add(iaydata); } } sdr.Close(); sdr.Dispose(); } catch (Exception ee) { } finally { if (scmd != null) { scmd.Dispose(); } if (scon.State == ConnectionState.Open) { scon.Dispose(); scon.Close(); } } return(repList); }
public static int SaveIayInsReport(_IayForm iaydata) { MySqlConnection scon = new MySqlConnection(WebConfigurationManager.ConnectionStrings["LocalMySqlServer"].ConnectionString + "; CharSet=utf8"); MySqlCommand scmd = new MySqlCommand(); scon.Open(); scmd.Connection = scon; int ret = -1; try { scmd.CommandText = "insert into iayreports (bfid,fdate,hlevel,idate,remark) values(@bfid,@fdate,@hlevel,@idate,@remark)"; scmd.Parameters.AddWithValue("bfid", iaydata.BENEF.BFID); scmd.Parameters.AddWithValue("fdate", DateTime.Now); scmd.Parameters.AddWithValue("hlevel", iaydata.HOUSELEVEL); scmd.Parameters.AddWithValue("idate", Convert.ToDateTime(iaydata.IDATE).ToString("yyyy-MM-dd")); scmd.Parameters.AddWithValue("remark", iaydata.REMARK); scmd.Prepare(); scmd.ExecuteNonQuery(); ret = Convert.ToInt32(scmd.LastInsertedId); } catch (Exception ee) { ret = -1; } finally { if (scmd != null) { scmd.Dispose(); } if (scon.State == ConnectionState.Open) { scon.Dispose(); scon.Close(); } } return(ret); }
// POST: api/PanchLevelReport public String Post(_IayForm value) { return(ReportPdfGen.PanchayatLevelPdfGen(value)); }
// POST: api/BlkLevelReport public String Post(_IayForm value) { return(ReportPdfGen.BlockLevelPdfGen(value)); }
// POST: api/IayIns public int Post(_IayForm value) { return(dbUtility.SaveIayInsReport(value)); }