예제 #1
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_Telesale_History_Call>("ID= {0}", request.ID);
                    if (checkExits == null)
                    {
                        var work = new CRM_Telesale_History_Call();
                        work.Title         = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                        work.CustomerID    = !string.IsNullOrEmpty(request.CustomerID) ? request.CustomerID.Trim() : "";
                        work.Description   = !string.IsNullOrEmpty(request.Description) ? request.Description : "";
                        work.GroupTypeID   = !string.IsNullOrEmpty(request.GroupTypeID) ? request.GroupTypeID.Trim() : "";
                        work.TypeRequestID = !string.IsNullOrEmpty(request.TypeRequestID) ? request.TypeRequestID.Trim() : "";
                        work.TrendID       = !string.IsNullOrEmpty(request.TrendID) ? request.TrendID.Trim() : "";
                        work.RecallTime    = !string.IsNullOrEmpty(request.RecallTime.ToString()) ? request.RecallTime : DateTime.Parse("1900-01-01");
                        work.BehavID       = !string.IsNullOrEmpty(request.BehavID) ? request.BehavID.Trim() : "";
                        work.Status        = !string.IsNullOrEmpty(request.Status) ? request.Status.Trim() : "YET";
                        work.Type          = !string.IsNullOrEmpty(request.Type) ? request.Type.Trim() : "";

                        work.RowCreatedUser = username;
                        work.RowUpdatedUser = "";
                        work.RowCreatedAt   = DateTime.Now;
                        work.RowUpdatedAt   = DateTime.Parse("1900-01-01");
                        dbConn.Insert(work);
                        //Portal_Message.SendMessage("administrator", "addWork", "Work insert !", "");
                        return(new { success = true, message = "Inserted success!" });
                    }
                    else
                    {
                        checkExits.Title         = !string.IsNullOrEmpty(request.Title) ? request.Title.Trim() : "";
                        checkExits.CustomerID    = !string.IsNullOrEmpty(request.CustomerID) ? request.CustomerID.Trim() : "";
                        checkExits.Description   = !string.IsNullOrEmpty(request.Description) ? request.Description : "";
                        checkExits.GroupTypeID   = !string.IsNullOrEmpty(request.GroupTypeID) ? request.GroupTypeID.Trim() : "";
                        checkExits.TypeRequestID = !string.IsNullOrEmpty(request.TypeRequestID) ? request.TypeRequestID.Trim() : "";
                        checkExits.TrendID       = !string.IsNullOrEmpty(request.TrendID) ? request.TrendID.Trim() : "";
                        checkExits.RecallTime    = !string.IsNullOrEmpty(request.RecallTime.ToString()) ? request.RecallTime : DateTime.Parse("1900-01-01");
                        checkExits.BehavID       = !string.IsNullOrEmpty(request.BehavID) ? request.BehavID.Trim() : "";
                        checkExits.Status        = !string.IsNullOrEmpty(request.Status) ? request.Status.Trim() : "YET";
                        checkExits.Type          = !string.IsNullOrEmpty(request.Type) ? request.Type.Trim() : "";

                        checkExits.RowUpdatedUser = username;
                        checkExits.RowUpdatedAt   = DateTime.Now;
                        dbConn.Update(checkExits);
                        return(new { success = true, message = "Update status" });
                    }
                }
                catch (Exception e)
                {
                    return(new { success = false, message = e.Message });
                }
            }
        }
예제 #2
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 });
         }
     }
 }
예제 #3
0
파일: CRM_Works.cs 프로젝트: war-man/BIBIAM
 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 });
         }
     }
 }