Ejemplo n.º 1
0
 public static object Update_Status(Int32 RowID, string userName)
 {
     using (IDbConnection dbConn = ERPAPD.Helpers.OrmliteConnection.openConn())
     {
         try
         {
             var appointment = dbConn.SingleOrDefault <CRM_Appointment>("RowID= {0}", RowID);
             if (appointment != null)
             {
                 appointment.Status         = "DONE";
                 appointment.RowUpdatedUser = userName;
                 appointment.RowUpdatedAt   = DateTime.Now;
                 dbConn.Update(appointment);
                 Portal_Message.SendMessage("administrator", "addAppointment", "Hoàn tất lịch hẹn !", "");
                 return(new { success = true, message = "Update status DONE" });
             }
             else
             {
                 return(new { success = false, message = "Failed" });
             }
         }
         catch (Exception e)
         {
             return(new { success = false, message = e.Message });
         }
     }
 }
Ejemplo n.º 2
0
 public static object Update_Status(Int32 RowID, string userName)
 {
     using (IDbConnection dbConn = ERPAPD.Helpers.OrmliteConnection.openConn())
     {
         try
         {
             var work = dbConn.SingleOrDefault <CRM_Works>("RowID= {0}", RowID);
             if (work != null)
             {
                 work.Status         = "DONE";
                 work.RowUpdatedUser = userName;
                 work.RowUpdatedAt   = DateTime.Now;
                 dbConn.Update(work);
                 Portal_Message.SendMessage("administrator", "addWork", "Work update !", "");
                 return(new { success = true, message = "Update status DONE" });
             }
             else
             {
                 return(new { success = false, message = "Failed" });
             }
         }
         catch (Exception e)
         {
             return(new { success = false, message = e.Message });
         }
     }
 }
Ejemplo n.º 3
0
        public static int SendMessage(string SendTo, string Type, string Description, string Link)
        {
            var mess = new Portal_Message();

            using (IDbConnection dbConn = OrmliteConnection.openConn())
            {
                mess.SendTo           = SendTo;
                mess.Type             = Type;
                mess.Description      = Description;
                mess.Link             = Link;
                mess.IsRead           = 0;
                mess.RowCreatedAt     = DateTime.Now;
                mess.RowCreatedBy     = HttpContext.Current.User.Identity.Name;
                mess.RowLastUpdatedAt = DateTime.Now;
                dbConn.Insert(mess);
            }

            ChatHub.SendGroup(SendTo, Description, Type);
            ChatHub.SendMessageToAll(SendTo, Description);
            return(1);
        }
Ejemplo n.º 4
0
 public static object Save(CRM_Ticket_Task_Appointment request, string username, string ticket = "")
 {
     using (IDbConnection dbConn = ERPAPD.Helpers.OrmliteConnection.openConn())
     {
         try
         {
             var checkExits = dbConn.SingleOrDefault <CRM_Appointment>("RowID= {0}", request.RowID);
             if (checkExits == null)
             {
                 var appointment = new CRM_Appointment();
                 appointment.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                 appointment.CustomerID     = !string.IsNullOrEmpty(request.CustomerID) ? request.CustomerID.Trim() : "";
                 appointment.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                 appointment.Address        = !string.IsNullOrEmpty(request.Address) ? request.Address.Trim() : "";
                 appointment.Hours          = !(request.Hours == 0) ? request.Hours : 0;
                 appointment.Description    = !string.IsNullOrEmpty(request.Description) ? request.Description : "";
                 appointment.Person_contact = !string.IsNullOrEmpty(request.Person_contact) ? request.Person_contact.Trim() : "";
                 appointment.Guests         = !string.IsNullOrEmpty(request.Guests) ? request.Guests.Trim() : "";
                 appointment.Bcc            = !string.IsNullOrEmpty(request.Bcc) ? request.Bcc.Trim() : "";
                 appointment.Date           = !string.IsNullOrEmpty(request.Date.ToString()) ? request.Date : DateTime.Parse("1900-01-01");
                 appointment.Type           = !string.IsNullOrEmpty(request.Type) ? request.Type.Trim() : "";
                 appointment.Status         = !string.IsNullOrEmpty(request.Status) ? request.Status.Trim() : "YET";
                 appointment.TicketID       = ticket;
                 if (ticket != "")
                 {
                     appointment.Date = !string.IsNullOrEmpty(request.RecallTime.ToString()) ? request.RecallTime : DateTime.Parse("1900-01-01");
                     appointment.Type = "APS01";
                 }
                 appointment.RowCreatedUser = username;
                 appointment.RowUpdatedUser = "";
                 appointment.RowCreatedAt   = DateTime.Now;
                 appointment.RowUpdatedAt   = DateTime.Parse("1900-01-01");
                 dbConn.Insert(appointment);
                 Portal_Message.SendMessage("administrator", "addAppointment", "Thêm lịch hẹn thành công !", "");
                 return(new { success = true, message = "Inserted success!" });
             }
             else
             {
                 if (checkExits.Status != "DONE")
                 {
                     checkExits.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                     checkExits.CustomerID     = !string.IsNullOrEmpty(request.CustomerID) ? request.CustomerID.Trim() : "";
                     checkExits.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                     checkExits.Address        = !string.IsNullOrEmpty(request.Address) ? request.Address.Trim() : "";
                     checkExits.Hours          = !(request.Hours == 0) ? request.Hours : 0;
                     checkExits.Description    = !string.IsNullOrEmpty(request.Description) ? request.Description : "";
                     checkExits.Person_contact = !string.IsNullOrEmpty(request.Person_contact) ? request.Person_contact.Trim() : "";
                     checkExits.Guests         = !string.IsNullOrEmpty(request.Guests) ? request.Guests.Trim() : "";
                     checkExits.Bcc            = !string.IsNullOrEmpty(request.Bcc) ? request.Bcc.Trim() : "";
                     checkExits.Date           = !string.IsNullOrEmpty(request.Date.ToString()) ? request.Date : DateTime.Parse("1900-01-01");
                     checkExits.Type           = !string.IsNullOrEmpty(request.Type) ? request.Type.Trim() : "";
                     checkExits.RowUpdatedAt   = DateTime.Now;
                     checkExits.RowUpdatedUser = username;
                     dbConn.Update(checkExits);
                     Portal_Message.SendMessage("administrator", "addAppointment", "Update lịch hẹn thành công !", "");
                     return(new { success = true, message = "Update status" });
                 }
                 return(new { success = false, message = "Đã làm xong không thể cập nhật" });
             }
         }
         catch (Exception e)
         {
             return(new { success = false, message = e.Message });
         }
     }
 }
Ejemplo n.º 5
0
 public static object Save(CRM_Ticket_Task_Appointment request, string username, string ticket = "")
 {
     using (IDbConnection dbConn = ERPAPD.Helpers.OrmliteConnection.openConn())
     {
         try
         {
             var checkExits = dbConn.SingleOrDefault <CRM_Works>("RowID= {0}", request.RowID);
             if (checkExits == null)
             {
                 var work = new CRM_Works();
                 work.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                 work.CustomerID     = !string.IsNullOrEmpty(request.CustomerID) ? request.CustomerID.Trim() : "";
                 work.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                 work.Description    = !string.IsNullOrEmpty(request.Description) ? request.Description : "";
                 work.Person_contact = !string.IsNullOrEmpty(request.Person_contact) ? request.Person_contact.Trim() : "";
                 work.Type           = !string.IsNullOrEmpty(request.Type) ? request.Type.Trim() : "";
                 work.Status         = !string.IsNullOrEmpty(request.Status) ? request.Status.Trim() : "YET";
                 work.Deadline       = !string.IsNullOrEmpty(request.Deadline.ToString()) ? request.Deadline : DateTime.Parse("1900-01-01");
                 work.RemindDate     = !string.IsNullOrEmpty(request.RemindDate.ToString()) ? request.RemindDate : DateTime.Parse("1900-01-01");
                 work.Performer      = !string.IsNullOrEmpty(request.Performer) ? request.Performer.Trim() : "";
                 work.Priority       = request.Priority != 0 ? request.Priority : 0;
                 work.TicketID       = ticket;
                 work.RowCreatedUser = username;
                 work.RowUpdatedUser = "";
                 work.RowCreatedAt   = DateTime.Now;
                 work.RowUpdatedAt   = DateTime.Parse("1900-01-01");
                 dbConn.Insert(work);
                 Portal_Message.SendMessage("administrator", "addWork", "Thêm công việc thành công", "");
                 return(new { success = true, message = "Inserted success!" });
             }
             else
             {
                 if (checkExits.Status != "DONE")
                 {
                     checkExits.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                     checkExits.CustomerID     = !string.IsNullOrEmpty(request.CustomerID) ? request.CustomerID.Trim() : "";
                     checkExits.Title          = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                     checkExits.Description    = !string.IsNullOrEmpty(request.Description) ? request.Description : "";
                     checkExits.Person_contact = !string.IsNullOrEmpty(request.Person_contact) ? request.Person_contact.Trim() : "";
                     checkExits.Type           = !string.IsNullOrEmpty(request.Type) ? request.Type.Trim() : "";
                     checkExits.Status         = !string.IsNullOrEmpty(request.Status) ? request.Status.Trim() : "YET";
                     checkExits.Deadline       = !string.IsNullOrEmpty(request.Deadline.ToString()) ? request.Deadline : DateTime.Parse("1900-01-01");
                     checkExits.Performer      = !string.IsNullOrEmpty(request.Performer) ? request.Performer.Trim() : "";
                     checkExits.Priority       = request.Priority != 0 ? request.Priority : 0;
                     checkExits.RowUpdatedUser = username;
                     checkExits.RowUpdatedAt   = DateTime.Now;
                     dbConn.Update(checkExits);
                     return(new { success = true, message = "Update status" });
                 }
                 else
                 {
                     return(new { success = false, message = "Không thể cập nhật trạng thái Hoàn tất" });
                 }
             }
         }
         catch (Exception e)
         {
             return(new { success = false, message = e.Message });
         }
     }
 }