public Ent_Organization SelectOrganization() { Ent_Organization ent = new Ent_Organization(); try { string query = "select * from EC_Organization where Is_Active=1;"; using (SqlCommand cmd = new SqlCommand(query, con)) { if (con.State == ConnectionState.Closed) { con.Open(); } IDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { ent = new Ent_Organization(); ent.Organization_ID = Convert.ToInt32(dr["Organization_ID"]); ent.Organization_Name = Convert.ToString(dr["Organization_Name"]); ent.Organization_Address = Convert.ToString(dr["Organization_Address"]); ent.Organization_ContactPerson = Convert.ToString(dr["Organization_ContactPerson"]); ent.Organization_Phone = Convert.ToString(dr["Organization_Phone"]); ent.Organization_State = Convert.ToString(dr["Organization_State"]); ent.Organization_Country = Convert.ToString(dr["Organization_Country"]); ent.organization_Email = Convert.ToString(dr["organization_email"]); ent.organization_Web = Convert.ToString(dr["organization_web"]); } } } catch (Exception e) { } finally { con.Close(); } return(ent); }
public Ent_Organization SelectOrganization() { Ent_Organization result = new Ent_Organization(); try { Dal_Master dal = new Dal_Master(); result = dal.SelectOrganization(); return(result); } catch { return(result); } }
public int SaveOrganization(Ent_Organization entGuest, SafeTransaction trans) { int dataResult = 0; try { Dal_Master dal = new Dal_Master(); dataResult = dal.SaveOrganization(entGuest, trans); return(dataResult); } catch { return(0); } }
public int SaveOrganization(Ent_Organization model) { int result = 0; SafeTransaction trans = new SafeTransaction(); DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE); DateTime indiTime = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s")); model.Created_Date = indiTime; //HttpCookie User_ID = Request.Cookies["User_ID"]; //model.Created_By = Convert.ToInt32(User_ID.Value.Split('=')[1]); model.Created_By = 1; result = balMaster.SaveOrganization(model, trans); if (result > 0) { trans.Commit(); } else { trans.Rollback(); } return(result); }
public int SaveOrganization(Ent_Organization ent, SafeTransaction trans) { int dataresult = 0; int dataresult1 = 0; try { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlCommand cmd = new SqlCommand("EC_InsertOrganization", trans.DatabaseConnection, trans.Transaction)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Organization_ID", ent.Organization_ID)); cmd.Parameters.Add(new SqlParameter("@Organization_Name", ent.Organization_Name)); cmd.Parameters.Add(new SqlParameter("@Organization_Address", ent.Organization_Address)); cmd.Parameters.Add(new SqlParameter("@Organization_ContactPerson", ent.Organization_ContactPerson)); cmd.Parameters.Add(new SqlParameter("@Organization_State", ent.Organization_State)); cmd.Parameters.Add(new SqlParameter("@Organization_Country", ent.Organization_Country)); cmd.Parameters.Add(new SqlParameter("@Organization_Phone", ent.Organization_Phone)); cmd.Parameters.Add(new SqlParameter("@organization_email", ent.organization_Email)); cmd.Parameters.Add(new SqlParameter("@organization_web", ent.organization_Web)); cmd.Parameters.Add(new SqlParameter("@Created_Date", ent.Created_Date)); cmd.Parameters.Add(new SqlParameter("@Created_By", ent.Created_By)); try { dataresult = Convert.ToInt32(cmd.ExecuteScalar()); if (dataresult > 0) { cmd.Dispose(); } } catch (Exception ex) { dataresult = -2; InsertException(ex.Message, "SaveOrganization", ent.Organization_ID); } } if (dataresult > 0) { using (SqlCommand cmd = new SqlCommand("EC_InsertLog", trans.DatabaseConnection, trans.Transaction)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Created_By", ent.Created_By)); cmd.Parameters.Add(new SqlParameter("@Created_Date", ent.Created_Date)); cmd.Parameters.Add(new SqlParameter("@Primary_Id", dataresult)); if (ent.Organization_ID > 0) { cmd.Parameters.Add(new SqlParameter("@Log_Action", "Update Organization")); } else { cmd.Parameters.Add(new SqlParameter("@Log_Action", "Insert Organization")); } cmd.Parameters.Add(new SqlParameter("@Log_Status", "Admin")); try { dataresult1 = Convert.ToInt32(cmd.ExecuteScalar()); if (dataresult1 > 0) { cmd.Dispose(); } } catch (Exception ex) { dataresult1 = -2; } } } } catch (Exception e) { dataresult = -2; } finally { con.Close(); } return(dataresult); }
public ActionResult Organization() { Ent_Organization ent = balMaster.SelectOrganization(); return(View(ent)); }