Ejemplo n.º 1
0
        public Int32 Insert(BOL.customer_address obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_customer_address.Insert(obj, conn, trans);
                    Int32 customerid = bll_utility.GetMaxId("customer_address", "Custaddressid", conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(customerid);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Ejemplo n.º 2
0
        public Int32 Insert(BOL.ticketattachment obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_ticketattachment.Insert(obj, conn, trans);
                    Int32 ticketattachment = bll_utility.GetMaxId("ticketattachment", "Ticketattachmentid", conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(ticketattachment);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Ejemplo n.º 3
0
        public Int32 Insert(BOL.Owais01BOL obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_objOwais01BLL.Insert(obj, conn, trans);
                    Int32 idNumber = bll_utility.GetMaxId("owais", "idNumber", conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(idNumber);
                }
                catch (Exception)
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public Int32 Insert(BOL.Hunaid1BOL obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bllhunaid1obj.Insert(obj, conn, trans);
                    Int32 id = bll_utility.GetMaxId("hunaid", "id", conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(id);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Ejemplo n.º 6
0
        public Int32 Insert(BOL.AhmedRazaBOL obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_objAhmedRazaBLL.Insert(obj, conn, trans);
                    Int32 idNumber = bll_utility.GetMaxId("AhmedRaza", "IdNumber", conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(idNumber);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Ejemplo n.º 7
0
        public Int32 ProcessTickets(List <BOL.customers> customersList, Int32 userid)
        {
            try
            {
                Initialize();
                conn = new MySqlConnection(ConnectionString);
                conn.Open();
                trans = conn.BeginTransaction();

                //bll_objCustomer.Insert(obj, conn, trans);
                //Int32 customerid = bll_utility.GetMaxId("customers", "Customerid", conn, trans);

                if (customersList != null && customersList.Count > 0)
                {
                    this.bol_customerses = customersList;
                    if (this.bol_customerses != null && this.bol_customerses.Count > 0)
                    {
                        foreach (BOL.customers c in this.bol_customerses)
                        {
                            if (!string.IsNullOrEmpty(c.Mobile))
                            {
                                bol_customer = VerifyCustomerbyMobile(c);
                                if (bol_customer.Customerid == 0)
                                {
                                    bol_customer.Status    = StatusEnum.firstcall.GetHashCode();
                                    bol_customer.Isdeleted = "F";
                                    bol_customer.Createdby = userid;
                                    bol_customer.Createdon = DateTime.Now;
                                    bol_customer.Modifyby  = userid;
                                    bol_customer.Modifyon  = DateTime.Now;
                                    bll_customer.Insert(c, conn, trans);
                                    bol_customer.Customerid = bll_utility.GetMaxId("customers", "Customerid", conn, trans);
                                }
                                if (c.Ticketses != null && c.Ticketses[0].Ticketattachments != null)
                                {
                                    bol_ticket.Customerid = bol_customer.Customerid;
                                    bol_ticket.Ticketid   = VerifyOpenAnonymousTicketbyCustomerid(bol_ticket);
                                }
                                if (bol_ticket.Ticketid == 0)
                                {
                                    bol_ticket.Ticketstatusid = TicketStatusEnum.Open.GetHashCode();
                                    bol_ticket.Description    = "Open ticket";
                                    bol_ticket.Title          = "Open ticket";
                                    if (bol_customer.Status == StatusEnum.firstcall.GetHashCode())
                                    {
                                        bol_ticket.Ticketstatusid = TicketStatusEnum.Anonymous.GetHashCode();
                                        bol_ticket.Description    = "Anonymous ticket";
                                        bol_ticket.Title          = "Anonymous ticket";
                                    }
                                    bol_ticket.Customerid = bol_customer.Customerid;
                                    bol_ticket.Isdeleted  = "F";
                                    bol_ticket.Createdby  = userid;
                                    bol_ticket.Createdon  = DateTime.Now;
                                    bol_ticket.Modifiedby = userid;
                                    bol_ticket.Modifiedon = DateTime.Now;
                                    bol_ticket.Userid     = userid;

                                    bll_tickets.Insert(bol_ticket, conn, trans);
                                    bol_ticket.Ticketid = bll_utility.GetMaxId("tickets", "Ticketid", conn, trans);
                                }
                                if (c.Ticketses != null && c.Ticketses[0].Ticketattachments != null &&
                                    c.Ticketses.Count > 0)
                                {
                                    foreach (BOL.ticketattachment tattch in c.Ticketses[0].Ticketattachments)
                                    {
                                        if (!string.IsNullOrEmpty(tattch.Link))
                                        {
                                            tattch.Isdeleted = "F";
                                            tattch.Ticketid  = bol_ticket.Ticketid;

                                            tattch.Ticketattachmentid = bll_ticketattach.Insert(tattch, conn, trans);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                trans.Commit();
                conn.Close();
                return(1);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (trans != null)
                {
                    trans.Rollback();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(0);
        }