예제 #1
0
 public ActionResult DeleteIncoming(LetterModelFromEdo model)
 {
     using (ncelsEntities db = new ncelsEntities())
     {
         OBK_LetterFromEdo edo = db.OBK_LetterFromEdo.Where(x => x.ID == model.ID).FirstOrDefault();
         if (edo != null)
         {
             db.OBK_LetterFromEdo.Remove(edo);
             db.SaveChanges();
         }
     }
     return(RedirectToAction("Incoming"));
 }
예제 #2
0
        public bool RecieveAnswerLetterFromEdo(CommingLetterFromEdo edoLetter)
        {
            long result = 0;

            try
            {
                LetterWithEdoRepository rep = new LetterWithEdoRepository(false);
                OBK_LetterFromEdo       edo = new OBK_LetterFromEdo();
                edo.IdEdo             = edoLetter.id_edo;
                edo.LetterRegNomer    = edoLetter.id_letter_edo;
                edo.LetterText        = edoLetter.letter_text;
                edo.LetterRegDate     = Convert.ToDateTime(edoLetter.date_letter_edo);
                edo.UserEdo           = edoLetter.user_edo;
                edo.LetterPortalEdoID = long.Parse(edoLetter.letter_obk);

                //string fileNameWithPath = Server.MapPath("/Content/json/rite.txt");
                //if (!File.Exists(fileNameWithPath))
                //{
                //    string createText = "Hello and Welcome" + edoLetter.id_edo+ edoLetter.id_letter_edo+ edoLetter.letter_text+ edoLetter.date_letter_edo+ edoLetter.user_edo+ edoLetter.letter_obk;
                //    File.WriteAllText(fileNameWithPath, createText);
                //}

                result = rep.saveIncomingLetter(edo);
                if (result != 0 && edoLetter.attachments.Count != 0)
                {
                    List <OBK_LetterAttachments> list = new List <OBK_LetterAttachments>();
                    foreach (CommingAttachFileFromEdo d in edoLetter.attachments)
                    {
                        OBK_LetterAttachments a = new OBK_LetterAttachments();
                        a.SignXmlBigData = d.sign;
                        a.LetterId       = result;
                        a.ContentFile    = System.Text.Encoding.UTF8.GetBytes(d.content);
                        list.Add(a);
                    }
                    rep.saveAttachFilesFromEdo(list);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
            if (result == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #3
0
        public long saveIncomingLetter(OBK_LetterFromEdo edoLetter)
        {
            long result = 0;

            try
            {
                AppContext.OBK_LetterFromEdo.Add(edoLetter);
                AppContext.SaveChanges();
                result = edoLetter.ID;
            }
            catch (Exception e)
            {
                return(0);
            }
            return(result);
        }
예제 #4
0
        public ActionResult DetailsIncoming(long id)
        {
            LetterModelFromEdo model = new LetterModelFromEdo();

            using (ncelsEntities db = new ncelsEntities())
            {
                OBK_LetterFromEdo dataFromDB = db.OBK_LetterFromEdo.Where(x => x.ID == id).FirstOrDefault();
                if (dataFromDB != null)
                {
                    model.ID              = dataFromDB.ID;
                    model.nomerDogovora   = dataFromDB.OBK_LetterPortalEdo.OBK_Contract.Number;
                    model.ObkLetterNumber = dataFromDB.OBK_LetterPortalEdo.OBK_LetterRegistration.LetterRegName;
                    model.LetterRegNomer  = dataFromDB.LetterRegNomer;
                    model.LetterRegDate   = dataFromDB.LetterRegDate;
                    model.UserEdo         = dataFromDB.UserEdo;
                    model.LetterText      = dataFromDB.LetterText;
                    model.senderOrg       = "НЦЭЛС";
                }
            }
            return(View(model));
        }