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);
        }
Esempio n. 2
0
        public async Task <ActionResult> Edit(int id, trxNotificationDetail Emp)
        {
            HttpResponseMessage responseMessage = await client.PutAsJsonAsync(url + "/" + id, Emp);

            if (responseMessage.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Error"));
        }
        public fReadInfoByIdNotification_Result ReadInfoByIdNotificationHead(int IdNotification)
        {
            trxNotificationDetail myDataDetail = new trxNotificationDetail();

            try
            {
                myDataDetail = ctx.trxNotificationDetail.Where(x => x.IdNotification.Equals(IdNotification) && x.flgTraySent.Equals(true)).FirstOrDefault();
            }
            catch (Exception ex)
            {
                string fff = ex.Message;
            }
            fReadInfoByIdNotification_Result myData = new fReadInfoByIdNotification_Result();

            if (myDataDetail != null)
            {
                myData = ctx.fReadInfoByIdNotification(myDataDetail.IdNotificationDetail, myDataDetail.flgTraySent).First();
            }
            return(myData);
        }
        private void UpdateInsertDraft(AddEditTDraftCaptionForm myDataForm)
        {
            if (myDataForm.IdNotification < 0)
            {
                int intNewIdNotification = 0;
                //  insert noti header
                //tambah baru header
                trxNotificationHeader myDataHeader = new trxNotificationHeader();
                myDataHeader.IdTipeNotification = 0;
                myDataHeader.IdLevelUrgensi     = myDataForm.IdLevelUrgensi;
                myDataHeader.CaptionInfo        = myDataForm.CaptionInfo;
                myDataHeader.IdDataProfilePart  = 0;
                myDataHeader.flgValidity        = true;
                //myDataHeader.CreatedUser = myDataForm.SubjectFromStr;
                myDataHeader.CreatedUser = myDataForm.SubjectFrom.ToString();
                myDataHeader.CreatedDate = DateTime.Today;
                intNewIdNotification     = _repHeader.PostNew(myDataHeader); //RETURN IdNotification diperlukan untuk Next

                //  insert noti content
                trxNotificationContent myDataContent = new trxNotificationContent();
                myDataContent.IdNotification = intNewIdNotification;
                myDataContent.BodyContent    = myDataForm.BodyContent;
                myDataContent.CreatedUser    = myDataForm.SubjectFromStr;
                myDataContent.CreatedDate    = DateTime.Today;
                myDataContent.Attachment     = myDataForm.Attachment;
                myDataContent.FileExt1       = myDataForm.FileExt1;
                myDataContent.FileExt2       = myDataForm.FileExt2;
                myDataContent.FileExt3       = myDataForm.FileExt3;
                _repContent.Post(myDataContent);

                if (myDataForm.IsRekanan)
                {
                    trxNotificationDetail myDataDetail = new trxNotificationDetail();
                    myDataDetail.IdNotification = intNewIdNotification;
                    myDataDetail.SubjectTo      = myDataForm.SubjectTo;
                    myDataDetail.SubjectFrom    = myDataForm.SubjectFrom;
                    if (myDataForm.FlagKirim)
                    {
                        myDataDetail.flgTraySent = true;
                        myDataDetail.TSentDate   = DateTime.Today;
                    }
                    else
                    {
                        myDataDetail.flgTraySent = false;
                    }
                    myDataDetail.flgTrayRead = false;
                    myDataDetail.CreatedUser = myDataForm.SubjectFrom.ToString();
                    myDataDetail.CreatedDate = DateTime.Today;
                    _repDetail.Post(myDataDetail);
                }
                else
                {
                    //  insert noti recipient
                    PopulateRecipient(intNewIdNotification, myDataForm.SubjectToStr, myDataForm.SubjectFrom, myDataForm.FlagKirim, myDataForm.IsSaluranEmail, myDataForm.IsSaluranWhatsapp);
                }
            }
            else
            {
                //update noti header
                trxNotificationHeader myDataHeader = new trxNotificationHeader();
                myDataHeader.IdNotification     = myDataForm.IdNotification;
                myDataHeader.IdTipeNotification = 0;
                myDataHeader.IdLevelUrgensi     = myDataForm.IdLevelUrgensi;
                myDataHeader.CaptionInfo        = myDataForm.CaptionInfo;
                myDataHeader.IdDataProfilePart  = 0;
                myDataHeader.flgValidity        = true;
                myDataHeader.CreatedUser        = myDataForm.SubjectFromStr;
                myDataHeader.CreatedDate        = DateTime.Today;
                _repHeader.Put(myDataHeader.IdNotification, myDataHeader);

                //update noti content
                trxNotificationContent myDataContent = new trxNotificationContent();
                //myDataContent.IdNotificationContent = myDataForm.IdNotificationContent;
                myDataContent.IdNotification = myDataForm.IdNotification;
                myDataContent.BodyContent    = myDataForm.BodyContent;
                myDataContent.CreatedUser    = myDataForm.SubjectFromStr;
                myDataContent.CreatedDate    = DateTime.Today;
                myDataContent.Attachment     = myDataForm.Attachment;
                myDataContent.FileExt1       = myDataForm.FileExt1;
                myDataContent.FileExt2       = myDataForm.FileExt2;
                myDataContent.FileExt3       = myDataForm.FileExt3;
                _repContent.Put(myDataForm.IdNotificationContent, myDataContent);

                if (myDataForm.IsRekanan)
                {
                    trxNotificationDetail myDataDetail = new trxNotificationDetail();
                    myDataDetail.IdNotification = myDataForm.IdNotification;
                    myDataDetail.SubjectTo      = myDataForm.SubjectTo;
                    myDataDetail.SubjectFrom    = myDataForm.SubjectFrom;
                    if (myDataForm.FlagKirim)
                    {
                        myDataDetail.flgTraySent = true;
                        myDataDetail.TSentDate   = DateTime.Today;
                    }
                    else
                    {
                        myDataDetail.flgTraySent = false;
                    }
                    myDataDetail.flgTrayRead = false;
                    myDataDetail.CreatedUser = myDataForm.SubjectFrom.ToString();
                    myDataDetail.CreatedDate = DateTime.Today;
                    _repDetail.Put(myDataForm.IdNotificationDetail, myDataDetail);
                }
                else
                {
                    //  insert noti recipient
                    PopulateRecipient(myDataForm.IdNotification, myDataForm.SubjectToStr, myDataForm.SubjectFrom, myDataForm.FlagKirim, myDataForm.IsSaluranEmail, myDataForm.IsSaluranWhatsapp);
                }
            }
        }
Esempio n. 5
0
 public IHttpActionResult Put(int id, trxNotificationDetail myData)
 {
     _repository.Put(id, myData);
     return(StatusCode(HttpStatusCode.NoContent));
 }
Esempio n. 6
0
 public IHttpActionResult Post(trxNotificationDetail myData)
 {
     _repository.Post(myData);
     return(Ok(myData));
 }