public Int32 Insert(BOL.status obj) { if (obj != null) { try { conn = new MySqlConnection(ConnectionString); conn.Open(); trans = conn.BeginTransaction(); bll_status.Insert(obj, conn, trans); Int32 status = bll_utility.GetMaxId("status", "Statusid", conn, trans); trans.Commit(); conn.Close(); return(status); } catch { trans.Rollback(); conn.Close(); } } return(0); }
//Manager.roles manager_roles; //List<BOL.roles> bol_roles; #endregion #region methods and functions public void Initialize() { manager_status = new Manager.status(); utility = new Utility(); bol_status = new BOL.status(); //manager_roles = new Manager.roles(); //bol_roles = new List<BOL.roles>(); }
public List <BOL.status> Select(BOL.status obj) { if (obj != null) { conn = new MySqlConnection(ConnectionString); conn.Open(); trans = conn.BeginTransaction(); DataSet ds = bll_status.Select(obj, conn, trans); trans.Commit(); conn.Close(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { List <BOL.status> statuses = new List <BOL.status>(); foreach (DataRow dr in ds.Tables[0].Rows) { BOL.status c = new BOL.status(); if (dr["Statusid"] != DBNull.Value && Convert.ToInt32(dr["Statusid"]) > 0) { c.Statusid = Convert.ToInt32(Convert.ToString(dr["Statusid"])); } if (dr["Statusname"] != DBNull.Value && !string.IsNullOrEmpty(Convert.ToString(dr["Statusname"]))) { c.Statusname = Convert.ToString(dr["Statusname"]); } if (dr["Createdby"] != DBNull.Value && Convert.ToInt32(dr["Createdby"]) > 0) { c.Createdby = Convert.ToInt32(Convert.ToString(dr["Createdby"])); } if (dr["Createdon"] != DBNull.Value && !string.IsNullOrEmpty(Convert.ToString(dr["Createdon"]))) { c.Createdon = Convert.ToDateTime(Convert.ToString(dr["Createdon"])); } if (dr["Isdeleted"] != DBNull.Value && !string.IsNullOrEmpty(Convert.ToString(dr["Isdeleted"]))) { c.Isdeleted = Convert.ToString(dr["Isdeleted"]); } if (dr["Modifyby"] != DBNull.Value && Convert.ToInt32(dr["Modifyby"]) > 0) { c.Modifiedby = Convert.ToInt32(Convert.ToString(dr["Modifyby"])); } if (dr["Modifyon"] != DBNull.Value && !string.IsNullOrEmpty(Convert.ToString(dr["Modifyon"]))) { c.Modifiedon = Convert.ToDateTime(Convert.ToString(dr["Modifyon"])); } statuses.Add(c); } return(statuses); } return(null); } return(null); }
public DataSet SelectAll(BOL.status obj, MySqlConnection conn, MySqlTransaction trans) { if (obj != null) { StringBuilder qry = new System.Text.StringBuilder(); qry.Append(@"SELECT `statusid`, `statusname`, `isdeleted`, `createdby`, `createdon`, `modifiedby`, `modifiedon` FROM `status` "); return(dbconnect.GetDataset(conn, trans, qry.ToString())); } return(null); }
//public void LoadRoles() //{ // bol_roles = manager_roles.Select(new BOL.roles(), SearchCriterias.all); // if (bol_roles != null && bol_roles.Count > 0) // { // ddlRoles.DataSource = bol_roles; // ddlRoles.DataTextField = "Rolename"; // ddlRoles.DataValueField = "roleid"; // ddlRoles.DataBind(); // ddlRoles.Items.Insert(0, new ListItem("--Select--", "-1")); // } //} public Int32 Save() { bol_status = new BOL.status(); manager_status = new Manager.status(); bol_status.Statusname = txtStatusName.Text; bol_status.Isdeleted = "F"; bol_status.Createdby = Convert.ToInt32(Session["userid"]); bol_status.Createdon = DateTime.Parse(System.DateTime.Now.ToString("dd/MMM/yyyy")); bol_status.Statusid = manager_status.Insert(bol_status); return(bol_status.Statusid); }
public Int32 Delete(BOL.status obj, MySqlConnection conn, MySqlTransaction trans) { if (obj != null) { try { string qry = @"DELETE FROM `status` WHERE `statusid`= " + obj.Statusid; dbconnect.ExecuteNonQuery(conn, trans, qry, null); return(1); } catch { } } return(0); }
public Int32 Insert(BOL.status obj, MySqlConnection conn, MySqlTransaction trans) { if (obj != null) { try { string qry = @"INSERT INTO `status`(`statusname`, `isdeleted`, `createdby`, `createdon`, `modifiedby`, `modifiedon`) VALUES ('" + obj.Statusname + "','F'," + obj.Createdby + ",STR_TO_DATE('" + obj.Createdon + "', '%c/%e/%Y %r')" + ",'','')"; dbconnect.GetScalar(conn, trans, qry, null); return(1); } catch { } } return(0); }
public Int32 Update(BOL.status obj, MySqlConnection conn, MySqlTransaction trans) { if (obj != null) { try { string qry = @"UPDATE `status` SET `statusname` = '" + obj.Statusname + "',`isdeleted` = '" + obj.Isdeleted + "',`createdby`= " + obj.Createdby + ",`createdon`= " + obj.Createdon + ",`modifiedby` =" + obj.Modifiedby + ",`modifiedon`= " + obj.Modifiedon + " WHERE `statusid`= " + obj.Statusid; dbconnect.GetScalar(conn, trans, qry, null); return(1); } catch { } } return(0); }
public DataSet Select(BOL.status obj, MySqlConnection conn, MySqlTransaction trans) { if (obj != null) { StringBuilder qry = new System.Text.StringBuilder(); qry.Append(@"SELECT `statusid`, `statusname`, `isdeleted`, `createdby`, `createdon`, `modifiedby`, `modifiedon` FROM `status` WHERE "); if (obj.Statusid > 0) { qry.Append("`customerid` = " + obj.Statusid + " AND"); } if (!string.IsNullOrEmpty(obj.Statusname)) { qry.Append("`statusname` = '" + obj.Statusname + "' AND"); } qry = qry.Remove(qry.Length - 3, qry.Length); return(dbconnect.GetDataset(conn, trans, qry.ToString())); } return(null); }
public Int32 Delete(BOL.status obj) { if (obj != null) { try { conn = new MySqlConnection(ConnectionString); conn.Open(); trans = conn.BeginTransaction(); bll_status.Delete(obj, conn, trans); trans.Commit(); conn.Close(); return(obj.Statusid); } catch { trans.Rollback(); conn.Close(); } } return(0); }