public AddEditTDraftCaptionForm GetDraftCaptionForm(int IdNotification, int SupervisorId, Guid SubjectFrom, string UserName) { AddEditTDraftCaptionForm myDataForm = new AddEditTDraftCaptionForm(); IEnumerable <fGetRekananByIdSupervisor_Result> myRekananList = new List <fGetRekananByIdSupervisor_Result>(); fGetSupervisorByRek_Result myDataSupervisor = new fGetSupervisorByRek_Result(); if (SupervisorId > 0) //penerima adalah beberapa rekanan, pengirim adalah admin pcp { myRekananList = _repRekanan.GetBySupervisorId(SupervisorId); myDataForm.SubjectToStr = "(daftar rekanan)"; } else //penerima adalah admin pcp, pengirim adalah rekanan { myDataSupervisor = _repRekanan.GetSupervisorByRek(SubjectFrom); myDataForm.SubjectTo = myDataSupervisor.IdRekanan; myDataForm.SubjectToStr = myDataSupervisor.UserName; } myDataForm.SubjectFrom = SubjectFrom; myDataForm.SubjectFromStr = UserName; List <SimpleRef> LevelUrgensiList = new List <SimpleRef>(); myDataForm.IdLevelUrgensi = 3; //default normal LevelUrgensiList.Add(new SimpleRef() { RefId = 1, RefDescription = "Kritikal" }); LevelUrgensiList.Add(new SimpleRef() { RefId = 2, RefDescription = "Penting" }); LevelUrgensiList.Add(new SimpleRef() { RefId = 3, RefDescription = "Normal" }); if (IdNotification > 0) { trxNotificationHeader myDataHeader = _repHeader.Get(IdNotification); myDataForm.CaptionInfo = myDataHeader.CaptionInfo; myDataForm.IdTipeNotification = myDataHeader.IdTipeNotification; myDataForm.IdLevelUrgensi = myDataHeader.IdLevelUrgensi; trxNotificationContent myDataContent = _repContent.GetByIdNotification(IdNotification); myDataForm.IdNotificationContent = myDataContent.IdNotificationContent; myDataForm.BodyContent = myDataContent.BodyContent; myDataForm.Attachment = myDataContent.Attachment; myDataForm.FileExt1 = myDataContent.FileExt1; myDataForm.FileExt2 = myDataContent.FileExt2; myDataForm.FileExt3 = myDataContent.FileExt3; trxNotificationDetail myDataDetail = _repDetail.GetByIdNotification(IdNotification); myDataForm.IdNotificationDetail = myDataDetail.IdNotificationDetail; } myDataForm.SubjectToColls = myRekananList; myDataForm.LevelUrgensiColls = LevelUrgensiList; return(myDataForm); }
public fGetSupervisorByRek_Result GetSupervisorByRek(Guid IdRekanan) { string strError = string.Empty; fGetSupervisorByRek_Result myData = new fGetSupervisorByRek_Result(); try { myData = ctx.fGetSupervisorByRek(IdRekanan).ToList <fGetSupervisorByRek_Result>().First(); } catch (Exception ex) { strError = ex.Message; } return(myData); }