Beispiel #1
0
        public Int32 Insert(BOL.ticketstatus obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_ticketstatus.Insert(obj, conn, trans);
                    Int32 ticketstatus = bll_utility.GetMaxId("ticketstatus", "Ticketstatusid", conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(ticketstatus);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Beispiel #2
0
        //Manager.roles manager_roles;
        //List<BOL.roles> bol_roles;


        #endregion

        #region methods and functions

        public void Initialize()
        {
            manager_ticketstatus = new Manager.ticketstatus();
            utility          = new Utility();
            bol_ticketstatus = new BOL.ticketstatus();
            //manager_roles = new Manager.roles();
            //bol_roles = new List<BOL.roles>();
        }
        public void LoadTicketStatuses()
        {
            manager_ticketstatus = new Manager.ticketstatus();
            bol_ticketstatus     = new BOL.ticketstatus();
            List <BOL.ticketstatus> _ticketStatuses = manager_ticketstatus.SelectAll(bol_ticketstatus);

            ddlTicketStatus.DataValueField = "Ticketstatusid";
            ddlTicketStatus.DataTextField  = "Ticketstatusname";
            ddlTicketStatus.DataSource     = _ticketStatuses;
            ddlTicketStatus.DataBind();
        }
Beispiel #4
0
        public DataSet SelectAll(BOL.ticketstatus obj, MySqlConnection conn, MySqlTransaction trans)
        {
            if (obj != null)
            {
                StringBuilder qry = new System.Text.StringBuilder();
                qry.Append(@"SELECT `ticketstatusid`, `ticketstatusname`, `description`, `isdeleted`, `createdby`, `createdon`, 
                                `modifiedby`, `modifiedon` FROM `ticketstatus`");

                return(dbconnect.GetDataset(conn, trans, qry.ToString()));
            }
            return(null);
        }
Beispiel #5
0
        //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_ticketstatus     = new BOL.ticketstatus();
            manager_ticketstatus = new Manager.ticketstatus();
            bol_ticketstatus.Ticketstatusname = txtStatusName.Text;
            bol_ticketstatus.Description      = txtStatusDiscription.Text;
            bol_ticketstatus.Isdeleted        = "F";
            bol_ticketstatus.Createdby        = Convert.ToInt32(Session["userid"]);
            bol_ticketstatus.Createdon        = DateTime.Parse(System.DateTime.Now.ToString("dd/MMM/yyyy"));
            bol_ticketstatus.Ticketstatusid   = manager_ticketstatus.Insert(bol_ticketstatus);
            return(bol_ticketstatus.Ticketstatusid);
        }
Beispiel #6
0
 public Int32 Delete(BOL.ticketstatus obj, MySqlConnection conn, MySqlTransaction trans)
 {
     if (obj != null)
     {
         try
         {
             string qry = @"DELETE FROM `ticketstatus` WHERE `ticketstatusid`= " + obj.Ticketstatusid;
             dbconnect.ExecuteNonQuery(conn, trans, qry, null);
             return(1);
         }
         catch
         {
         }
     }
     return(0);
 }
Beispiel #7
0
 public Int32 Update(BOL.ticketstatus obj, MySqlConnection conn, MySqlTransaction trans)
 {
     if (obj != null)
     {
         try
         {
             string qry = @"UPDATE `ticketstatus` SET `ticketstatusname` = '" + obj.Ticketstatusname + "',`description`=" + obj.Description +
                          "',`isdeleted`='" + obj.Isdeleted + "',`createdby`=" + obj.Createdby + ",`createdon`=" + obj.Createdon + ",`modifiedby`=" + obj.Modifiedby +
                          ",`modifiedon` = " + obj.Modifiedon + "  WHERE `ticketstatusid`=" + obj.Ticketstatusid;
             dbconnect.GetScalar(conn, trans, qry, null);
             return(1);
         }
         catch
         {
         }
     }
     return(0);
 }
Beispiel #8
0
 public Int32 Insert(BOL.ticketstatus obj, MySqlConnection conn, MySqlTransaction trans)
 {
     if (obj != null)
     {
         try
         {
             string qry = @"INSERT INTO `ticketstatus`(`ticketstatusname`, `description`, `isdeleted`, 
                                 `createdby`, `createdon`, `modifiedby`, `modifiedon`) 
                                 VALUES ('" + obj.Ticketstatusname + "','" + obj.Description + "','F'," + obj.Createdby + ",STR_TO_DATE('" + obj.Createdon + "', '%c/%e/%Y %r')" +
                          ",'','')";
             dbconnect.GetScalar(conn, trans, qry, null);
             return(1);
         }
         catch
         {
         }
     }
     return(0);
 }
Beispiel #9
0
 public DataSet Select(BOL.ticketstatus obj, MySqlConnection conn, MySqlTransaction trans)
 {
     if (obj != null)
     {
         StringBuilder qry = new System.Text.StringBuilder();
         qry.Append(@"SELECT `ticketstatusid`, `ticketstatusname`, `description`, `isdeleted`, `createdby`, `createdon`, 
                         `modifiedby`, `modifiedon` FROM `ticketstatus` WHERE ");
         if (obj.Ticketstatusid > 0)
         {
             qry.Append("`ticketstatusid` = " + obj.Ticketstatusid + " AND");
         }
         if (!string.IsNullOrEmpty(obj.Ticketstatusname))
         {
             qry.Append("`ticketstatusname` = '" + obj.Ticketstatusname + "' AND");
         }
         if (!string.IsNullOrEmpty(obj.Description))
         {
             qry.Append("`description` = '" + obj.Description + "' AND");
         }
         qry = qry.Remove(qry.Length - 3, qry.Length);
         return(dbconnect.GetDataset(conn, trans, qry.ToString()));
     }
     return(null);
 }
Beispiel #10
0
        public Int32 Delete(BOL.ticketstatus obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_ticketstatus.Delete(obj, conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(obj.Ticketstatusid);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Beispiel #11
0
        public List <BOL.ticketstatus> SelectAll(BOL.ticketstatus obj)
        {
            if (obj != null)
            {
                conn = new MySqlConnection(ConnectionString);
                conn.Open();
                trans = conn.BeginTransaction();

                DataSet ds = bll_ticketstatus.SelectAll(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.ticketstatus> ticketstatuses = new List <BOL.ticketstatus>();
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        BOL.ticketstatus c = new BOL.ticketstatus();

                        if (dr["Ticketstatusid"] != null && Convert.ToInt32(dr["Ticketstatusid"]) > 0)
                        {
                            c.Ticketstatusid = Convert.ToInt32(Convert.ToString(dr["Ticketstatusid"]));
                        }
                        if (dr["Description"] != null && !string.IsNullOrEmpty(Convert.ToString(dr["Description"])))
                        {
                            c.Description = Convert.ToString(dr["Description"]);
                        }
                        if (dr["Ticketstatusname"] != null && !string.IsNullOrEmpty(Convert.ToString(dr["Ticketstatusname"])))
                        {
                            c.Ticketstatusname = Convert.ToString(dr["Ticketstatusname"]);
                        }
                        if (dr["Createdby"] != null && Convert.ToInt32(dr["Createdby"]) > 0)
                        {
                            c.Createdby = Convert.ToInt32(Convert.ToString(dr["Createdby"]));
                        }
                        if (dr["Createdon"] != null && !string.IsNullOrEmpty(Convert.ToString(dr["Createdon"])))
                        {
                            c.Createdon = Convert.ToDateTime(Convert.ToString(dr["Createdon"]));
                        }
                        if (dr["Isdeleted"] != null && !string.IsNullOrEmpty(Convert.ToString(dr["Isdeleted"])))
                        {
                            c.Isdeleted = Convert.ToString(dr["Isdeleted"]);
                        }
                        if (dr["Modifiedby"] != null && Convert.ToInt32(dr["Modifiedby"]) > 0)
                        {
                            c.Modifiedby = Convert.ToInt32(Convert.ToString(dr["Modifiedby"]));
                        }
                        if (dr["Modifiedon"] != null && !string.IsNullOrEmpty(Convert.ToString(dr["Modifiedon"])))
                        {
                            c.Modifiedon = Convert.ToDateTime(Convert.ToString(dr["Modifiedon"]));
                        }

                        ticketstatuses.Add(c);
                    }
                    return(ticketstatuses);
                }

                return(null);
            }
            return(null);
        }
 public void Initialize()
 {
     manager_ticketstatus = new Manager.ticketstatus();
     utility          = new Utility();
     bol_ticketstatus = new BOL.ticketstatus();
 }