Exemple #1
0
        public async Task <ActionResult> _AddEditTDraftContainer(int IdNotification, AddEditTDraftCaptionForm myDataForm)
        {
            HttpResponseMessage responseMessage = await client.PutAsJsonAsync(urlHeader + "/" + IdNotification, myDataForm);

            if (responseMessage.IsSuccessStatusCode)
            {
                return(RedirectToAction("_AddEditTDraftContainer"));
            }
            return(RedirectToAction("Error"));
        }
Exemple #2
0
        public async Task <ActionResult> _ReadNotiDetail(int IdNotificationDetail, bool FlgTraySent, bool AllowReply)
        {
            //jika flag kirim = 1, berarti posisi di inbox, perlu set flagStatusBaca dan flagTanggalBaca
            if (FlgTraySent)
            {
                if (AllowReply)
                {
                    AddEditTDraftCaptionForm myDataNew       = new AddEditTDraftCaptionForm();
                    HttpResponseMessage      responseMessage = client.GetAsync(string.Format("{0}/ReadInfoByIdNotification/{1}/{2}", urlHeader, IdNotificationDetail.ToString(), FlgTraySent.ToString())).Result;
                    if (responseMessage.IsSuccessStatusCode)
                    {
                        var responseData = responseMessage.Content.ReadAsStringAsync().Result;
                        //ViewData["FlgTraySent"] = FlgTraySent;
                        var myData = JsonConvert.DeserializeObject <readInfoByIdNotiForm>(responseData);
                        //tukar pengirim menjadi penerima dan sebaliknya, reset IdNotification menjadi -1
                        myDataNew.IdNotification      = -1;
                        myDataNew.SubjectFrom         = myData.ReadInfoByNoti.SubjectTo;
                        myDataNew.SubjectTo           = myData.ReadInfoByNoti.SubjectFrom;
                        myDataNew.CaptionInfo         = "RE : " + myData.ReadInfoByNoti.CaptionInfo;
                        myDataNew.IdTipeNotification  = myData.ReadInfoByNoti.IdTipeNotification;
                        myDataNew.IdLevelUrgensi      = myData.ReadInfoByNoti.IdLevelUrgensi;
                        myDataNew.SubjectToStr        = myData.ReadInfoByNoti.From_Name;
                        myDataNew.SubjectFromStr      = myData.ReadInfoByNoti.To_Name;
                        myDataNew.TipeNotifikasiColls = myData.TipeNotifikasiColls;
                        myDataNew.LevelUrgensiColls   = myData.LevelUrgensiColls;
                        myDataNew.BodyContent         = Environment.NewLine + Environment.NewLine + Environment.NewLine
                                                        + new string('-', 7) + " REPLY " + new string('-', 7)
                                                        + Environment.NewLine + myData.ReadInfoByNoti.BodyContent;
                        myDataNew.Attachment            = Guid.NewGuid();
                        ImageContainerUpd.ImageBaseName = myDataNew.Attachment;
                        ViewBag.IsRekanan = true; //agar tidak perlu pilih tujuan pengiriman

                        return(View("_AddEditTDraftReply", myDataNew));
                    }
                }
                else
                {
                    HttpResponseMessage responseMessage = await client.GetAsync(urlDetail + "/ReadNotiDetail/" + IdNotificationDetail.ToString());

                    if (responseMessage.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("GetNotiInboxSentDraft", "TrxNotificationHeader"));
                    }
                }
            }
            else //jika flag kirim = 0, berarti posisi di draft, tidak perlu set flagBaca
            {
                return(RedirectToAction("GetNotiInboxSentDraft", "TrxNotificationHeader"));
            }
            return(RedirectToAction("Error"));
        }
Exemple #3
0
        public async Task <ActionResult> _AddEditTDraft(int IdNotification, AddEditTDraftCaptionForm myDataForm, string customValue, string RecipientList)
        {
            bool IsRekanan = true;
            bool flgKirim  = false;

            if (customValue == "K")
            {
                flgKirim = true;
            }
            myDataForm.FlagKirim = flgKirim;

            if ((int)tokenContainer.SupervisorId > 0)
            {
                IsRekanan = false;
            }
            myDataForm.IsRekanan    = IsRekanan;
            myDataForm.SubjectToStr = RecipientList;

            //myDataForm.FileName1 = ImageContainerUpd.ImageFile1;
            //myDataForm.FileName2 = ImageContainerUpd.ImageFile2;
            //myDataForm.FileName3 = ImageContainerUpd.ImageFile3;

            //myDataForm.FileExt1 = ImageContainerUpd.ImageExtension1;
            //myDataForm.FileExt2 = ImageContainerUpd.ImageExtension2;
            //myDataForm.FileExt3 = ImageContainerUpd.ImageExtension3;

            trxNotificationHeader myDataOri       = new trxNotificationHeader();
            HttpResponseMessage   responseMessage = await client.PutAsJsonAsync(urlHeader + "/" + IdNotification, myDataForm);

            //HttpResponseMessage responseMessage = await client.PutAsJsonAsync(url + "/" + IdNotification, myDataOri);
            if (responseMessage.IsSuccessStatusCode)
            {
                return(RedirectToAction("GetNotiInboxSentDraft"));
            }
            return(RedirectToAction("Error"));
        }
        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);
                }
            }
        }
 public IHttpActionResult Post(AddEditTDraftCaptionForm myData)
 {
     return(Ok(myData));
 }