//Güncelleme İşlemi //[System.Web.Http.HttpPost] public HttpResponseMessage Tamamlandi(int?id, int?durumId, int?aktiviteTipiId, string aciklama, string ss) { Aktivite item = ce.Aktivite.First(f => f.Id == id); AktiviteDurumu ad = ce.AktiviteDurumu.Where(x => x.AktiviteTipiId == aktiviteTipiId && x.Aciklama == "Tamamlandı").SingleOrDefault <AktiviteDurumu>(); //item.FirstName = student.FirstName; //item.LastName = student.LastName; //item.Age = student.Age; //item.Gender = student.Gender; //item.Aciklama = item.Aciklama + " " + aciklama; if (ad != null) { item.AktiviteDurumuId = ad.Id; } item.OperasyondaMi = true; ActiviteAciklamalari ac = new ActiviteAciklamalari(); ac.Aciklama = aciklama; ac.AktiviteId = id; ac.CreateUser = item.PersonelId; ac.PersonelId = item.PersonelId; ac.CreateDate = DateTime.Now; ac.Tarih = DateTime.Now; ce.ActiviteAciklamalari.Add(ac); ce.SaveChanges(); return(Request.CreateErrorResponse(HttpStatusCode.OK, " durumId:" + durumId + " id:" + id)); }
//Silme İşlemi public void Delete(int id) { Aktivite item = ce.Aktivite.First(f => f.Id == id); ce.Aktivite.Remove(item); ce.SaveChanges(); }
//Güncelleme İşlemi // [System.Web.Http.HttpPost] public HttpResponseMessage Tamamlandi(int?id, int?durumId, int?aktiviteTipiId, string aciklama, string ss) { Aktivite item = ce.Aktivite.First(f => f.Id == id); AktiviteDurumu ad = ce.AktiviteDurumu.Where(x => x.AktiviteTipiId == aktiviteTipiId && x.Aciklama == "Tamamlandı").SingleOrDefault <AktiviteDurumu>(); //item.FirstName = student.FirstName; //item.LastName = student.LastName; //item.Age = student.Age; //item.Gender = student.Gender; item.Aciklama = item.Aciklama + " " + aciklama; if (ad != null) { item.AktiviteDurumuId = ad.Id; } item.OperasyondaMi = true; ce.SaveChanges(); return(null); }
//Güncelleme İşlemi //[System.Web.Http.HttpPost] public HttpResponseMessage iptal(int?id, int?durumId, int?aktiviteTipiId, string aciklama, string iptal) { Aktivite item = ce.Aktivite.First(f => f.Id == id); AktiviteDurumu ad = ce.AktiviteDurumu.Where(x => x.AktiviteTipiId == aktiviteTipiId && x.Aciklama == "Beklemede").SingleOrDefault <AktiviteDurumu>(); //item.FirstName = student.FirstName; //item.LastName = student.LastName; //item.Age = student.Age; //item.Gender = student.Gender; item.PersonelId = 23; item.Aciklama = item.Aciklama + " " + aciklama; if (ad != null) { item.AktiviteDurumuId = ad.Id; } ce.SaveChanges(); return(Request.CreateErrorResponse(HttpStatusCode.OK, " durumId:" + durumId + " id:" + id)); }
// ekleme public void Post(Aktivite aktivite) { ce.Aktivite.Add(aktivite); ce.SaveChanges(); }
// ekleme public void Post(Aktivite aktivite) { }
public Ticket TicketMethod(int UserId, int ParrentId) { var Layer = EmptorDB.Database.SqlQuery <TicketItemList>(@" SELECT DISTINCT CT.ID AS EMPTOR_ID, CT.IDDESC AS 'EMPTOR_IDDESC', C.FULLNAME AS ILGILI_FIRMA_ADI, TY.DESCRIPTION_TR AS SERVIS_TIPI, CT.NAME AS SERVIS_TANIMI, CT.NOTES AS OZET_BILGI, CT.SOLUTIONEXPLANATION AS 'COZUM_ACIKLAMASI', TS.DESCRIPTION_TR AS KAYIT_DURUMU, USR.FULLNAME AS ANA_SORUMLU, TSB.DESCRIPTION_TR AS SAHA_ALT_STATUSU, OND.DESCRIPTION_TR AS ONE_SEVIYE_SAHA_ALT_STATUSU, TA.DESCRIPTION_TR AS SERVIS_ALANI, TAA.DESCRIPTION_TR AS SERVIS_ALT_ALANI, CTCC.NAME AS KOSUL, CT.C_MAXINTERVENTIONDATE AS SLA_MUDEHALE_TARIHI, CT.C_MAXSOLUTIONDATE AS SLA_COZUM_TARIHI, CASE WHEN CT.C_MAXINTERVENTIONDATE > CT.C_INTERVENTIONDATE THEN CONVERT(bit,1) ELSE CONVERT(bit,0) END AS SLA_MUDEHALE, CASE WHEN CT.C_MAXSOLUTIONDATE > CT.C_SOLUTIONDATE THEN CONVERT(bit,1) ELSE CONVERT(bit,0) END AS SLA_COZUM, CASE WHEN (SELECT CONVERT(int,COUNT(*)) FROM CRMTBL_ACTIVITY AS TA WHERE 1 = 1 AND TA.TICKETID = CT.ID) > 0 THEN CONVERT(bit,1) ELSE CONVERT(bit,0) END AS AKTITE_VARMI, CASE WHEN (SELECT CONVERT(int,COUNT(*)) FROM PROTBL_INVENTORYTRANSACTIONDETAIL AS EN WITH(NOLOCK) WHERE 1 = 1 AND EN.TICKETID=CT.ID) > 0 THEN CONVERT(bit,1) ELSE CONVERT(bit,0) END AS ENVANTER_HARKETI_VARMI, (SELECT CONVERT(int,COUNT(*)) FROM CRMTBL_ACTIVITY AS TA WHERE 1 = 1 AND TA.TICKETID = CT.ID) AS AKTIVITE_SAYISI, (SELECT CONVERT(int,COUNT(*)) FROM PROTBL_INVENTORYTRANSACTIONDETAIL AS EN WITH(NOLOCK) WHERE 1 = 1 AND EN.TICKETID=CT.ID) AS ENVANTER_SAYISI FROM CRMTBL_TICKET AS CT INNER JOIN CRMTBL_CUSTOMER AS C WITH(NOLOCK) ON C.ID = CT.C_CONCERNEDACCOUNTID INNER JOIN CRMTBL_TICKETTYPE AS TY WITH(NOLOCK) ON TY.ID = CT.TICKETTYPEID INNER JOIN CRMTBL_TICKETSTATUS AS TS WITH(NOLOCK) ON TS.ID = CT.TICKETSTATUSID INNER JOIN BIZTBL_USER AS USR WITH(NOLOCK) ON USR.ID = CT.RESPONSIBLEUSERID INNER JOIN PROTBL_TICKETSTATUSSUB AS TSB WITH(NOLOCK) ON TSB.ID = CT.C_TICKETSTATUSSUBID LEFT OUTER JOIN PROTBL_TICKETSTATUSSUB_LEVELONE AS OND WITH(NOLOCK) ON OND.ID = CT.C_TICKETSTATUSSUBID_LEVELONE LEFT OUTER JOIN PROTBL_TICKETAREA AS TA WITH(NOLOCK) ON TA.ID = CT.C_TICKETAREAID LEFT OUTER JOIN PROTBL_TICKETAREASUB AS TAA WITH(NOLOCK) ON TAA.ID = CT.C_TICKETSUBAREAID INNER JOIN CRMTBL_CONTRACTCONDITION AS CTCC WITH(NOLOCK) ON CTCC.ID = CT.CONTRACTCONDITIONID LEFT OUTER JOIN CRMTBL_ACTIVITY AS CTA WITH(NOLOCK) ON CTA.TICKETID = CT.ID LEFT OUTER JOIN PROTBL_TICKETATTACHMENT AS TAT WITH(NOLOCK) ON TAT.TICKETID = CT.ID LEFT OUTER JOIN PROTBL_INVENTORYTRANSACTIONDETAIL AS INV WITH(NOLOCK) ON INV.TICKETID = CT.ID WHERE 1 = 1 AND CT.ACTIVE = 1 AND CT.RESPONSIBLEUSERID=" + UserId + @" AND CT.TICKETSTATUSID=1 AND CT.C_TICKETSTATUSSUBID IN (4,6,93) AND (CT.C_TICKETAREAID IS NOT NULL AND CT.C_TICKETSUBAREAID IS NOT NULL) AND (CTCC.ID IS NOT NULL) AND (CTA.ID IS NOT NULL) AND (CT.SOLUTIONEXPLANATION IS NOT NULL) --AND (TAT.ID IS NOT NULL) AND (CTCC.NAME IS NOT NULL) AND (INV.TICKETID IS NULL) AND (C.DEFPARENTCUSTOMERID = " + ParrentId + @") ORDER BY CT.ID DESC ").ToArray(); List <TicketItemList> ticketItemLists = new List <TicketItemList>(); foreach (var item in Layer) { var EmptorAktivite = EmptorDB.Database.SqlQuery <Aktivite>(@" SELECT DISTINCT U.FULLNAME, U.EMAIL, --P.DESCRIPTION_TR, CTA.STARTDATE, CTA.ENDDATE, CTA.RESPONSIBLEUSERID, AKTYPE.ID AS AKTIVITE_TYPE_ID, AKTYPE.DESCRIPTION_TR AS AKTIVITE_TYPE, CTA.DESCRIPTION, CTA.CREATE_USER_ID, CTA.CREATE_USER_TIME, CONVERT(bit,CTA.IsTerminal) AS TERMINAL FROM CRMTBL_ACTIVITY AS CTA INNER JOIN BIZTBL_USER AS U WITH(NOLOCK) ON U.ID = CTA.CREATE_USER_ID INNER JOIN CRMTBL_ACTIVITYTYPE AS AKTYPE WITH(NOLOCK) ON AKTYPE.ID = CTA.ACTIVITYTYPEID WHERE 1 = 1 AND CTA.ACTIVE=1 AND CTA.TICKETID=" + item.EMPTOR_ID + "").ToArray(); List <Aktivite> aktivites = new List <Aktivite>(); foreach (var EItem in EmptorAktivite) { DateTime AktiviteGirisTarihi = EItem.CREATE_USER_TIME; DateTime AktiviteBaslangicTarihi = EItem.STARTDATE; DateTime AktiviteBitisTarihi = EItem.ENDDATE; Aktivite aktivite = new Aktivite() { FULLNAME = EItem.FULLNAME, EMAIL = EItem.EMAIL, DESCRIPTION = EItem.DESCRIPTION, STARTDATE = EItem.STARTDATE, ENDDATE = EItem.ENDDATE, RESPONSIBLEUSERID = EItem.RESPONSIBLEUSERID, AKTIVITE_TYPE_ID = EItem.AKTIVITE_TYPE_ID, AKTIVITE_TYPE = EItem.AKTIVITE_TYPE, CREATE_USER_ID = EItem.CREATE_USER_ID, CREATE_USER_TIME = EItem.CREATE_USER_TIME, TERMINAL = EItem.TERMINAL }; aktivites.Add(aktivite); } TicketItemList ticketItemList = new TicketItemList() { EMPTOR_ID = item.EMPTOR_ID, EMPTOR_IDDESC = item.EMPTOR_IDDESC, ILGILI_FIRMA_ADI = item.ILGILI_FIRMA_ADI, SERVIS_TIPI = item.SERVIS_TIPI, SERVIS_TANIMI = item.SERVIS_TANIMI, OZET_BILGI = item.OZET_BILGI, COZUM_ACIKLAMASI = item.COZUM_ACIKLAMASI, KAYIT_DURUMU = item.KAYIT_DURUMU, ANA_SORUMLU = item.ANA_SORUMLU, SAHA_ALT_STATUSU = item.SAHA_ALT_STATUSU, ONE_SEVIYE_SAHA_ALT_STATUSU = item.ONE_SEVIYE_SAHA_ALT_STATUSU, SERVIS_ALANI = item.SERVIS_ALANI, SERVIS_ALT_ALANI = item.SERVIS_ALT_ALANI, KOSUL = item.KOSUL, SLA_MUDEHALE_TARIHI = item.SLA_MUDEHALE_TARIHI, SLA_COZUM_TARIHI = item.SLA_COZUM_TARIHI, SLA_MUDEHALE = item.SLA_MUDEHALE, SLA_COZUM = item.SLA_COZUM, AKTITE_VARMI = item.AKTITE_VARMI, ENVANTER_HARKETI_VARMI = item.ENVANTER_HARKETI_VARMI, AKTIVITE_SAYISI = item.AKTIVITE_SAYISI, ENVANTER_SAYISI = item.ENVANTER_SAYISI, Activites = aktivites }; ticketItemLists.Add(ticketItemList); } Ticket Baris = new Ticket() { IsCode = true, Message = "Kayıtlar başarıyla listelenmiştir.", Items = ticketItemLists }; return(Baris); }