Beispiel #1
0
        public async Task <ModelResponseC34Message> UpdateDocMenuC34EditAsync(ModelMenuC34 model)
        {
            ModelResponseC34Message resp = new ModelResponseC34Message();

            switch (model.agenda4term)
            {
            case "1":
            case "2":
            case "3":
            case "4":
            case "8":
            case "9":
                if (string.IsNullOrEmpty(model.tab4Group1Seq1Input1))
                {
                    resp.Status  = false;
                    resp.Message = "กรุณาตรวจสอบและลงความเห็นของกรรมการ!";
                    goto gotoRespone;
                }
                break;
            }

            model.file1name = string.IsNullOrEmpty(model.file1name) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.file1name);
            resp            = await _IDocMenuC3Repository.UpdateDocMenuC34EditAsync(model);

            if (resp.Status)
            {
                if (!string.IsNullOrEmpty(model.file1base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuC3Tab4, model.file1name, model.file1base64);
                }
            }

gotoRespone:
            return(resp);
        }
Beispiel #2
0
        public async Task <ModelResponseC32Message> UpdateDocMenuC32EditAsync(ModelMenuC32 model)
        {
            model.tab2Group1Seq1FileInput2 = string.IsNullOrEmpty(model.tab2Group1Seq1FileInput2) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.tab2Group1Seq1FileInput2);
            model.tab2Group1Seq2FileInput2 = string.IsNullOrEmpty(model.tab2Group1Seq2FileInput2) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.tab2Group1Seq2FileInput2);
            model.tab2Group1Seq3FileInput2 = string.IsNullOrEmpty(model.tab2Group1Seq3FileInput2) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.tab2Group1Seq3FileInput2);

            var resp = await _IDocMenuC3Repository.UpdateDocMenuC32EditAsync(model);

            if (resp.Status)
            {
                if (!string.IsNullOrEmpty(model.tab2Group1Seq1FileInput2Base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuC3Tab2, model.tab2Group1Seq1FileInput2, model.tab2Group1Seq1FileInput2Base64);
                }
                if (!string.IsNullOrEmpty(model.tab2Group1Seq2FileInput2Base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuC3Tab2, model.tab2Group1Seq2FileInput2, model.tab2Group1Seq2FileInput2Base64);
                }
                if (!string.IsNullOrEmpty(model.tab2Group1Seq3FileInput2Base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuC3Tab2, model.tab2Group1Seq3FileInput2, model.tab2Group1Seq3FileInput2Base64);
                }
            }
            return(resp);
        }
Beispiel #3
0
        public async Task <ModelResponseA4Message> UpdateDocMenuA4EditAsync(ModelMenuA4 model)
        {
            model.file1name      = (string.IsNullOrEmpty(model.file1base64)) ? model.file1name : GenerateToken.GetGuid() + Path.GetExtension(model.file1name);
            model.conclusiondate = Convert.ToDateTime(model.conclusiondate.Substring(0, 10)).ToString("yyyy-MM-dd");

            var resp = await _IDocMenuA4Repository.UpdateDocMenuA4EditAsync(model);

            if (resp.Status)
            {
                if (!string.IsNullOrEmpty(model.file1base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA4, model.file1name, model.file1base64);
                }
            }

            return(resp);
        }
Beispiel #4
0
        public async Task <ModelResponseA2Message> AddDocMenuA2Async(ModelMenuA2 model)
        {
            model.docdate   = DateTime.Now;
            model.filename1 = string.IsNullOrEmpty(model.filename1) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.filename1);
            model.filename2 = string.IsNullOrEmpty(model.filename2) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.filename2);

            var resp = await _IDocMenuA2Repository.AddDocMenuA2Async(model);

            if (resp.Status)
            {
                if (!string.IsNullOrEmpty(model.filename1base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA2, model.filename1, model.filename1base64);
                }
                if (!string.IsNullOrEmpty(model.filename2base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA2, model.filename2, model.filename2base64);
                }
            }

            return(resp);
        }
Beispiel #5
0
        public async Task <ModelResponseA1Message> AddDocMenuA1Async(ModelMenuA1 model)
        {
            model.docdate     = DateTime.Now;
            model.projecthead = Encoding.UTF8.GetString(Convert.FromBase64String(model.projecthead));
            model.file1name   = string.IsNullOrEmpty(model.file1name) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.file1name);
            model.file2name   = string.IsNullOrEmpty(model.file2name) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.file2name);
            model.file3name   = string.IsNullOrEmpty(model.file3name) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.file3name);
            model.file4name   = string.IsNullOrEmpty(model.file4name) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.file4name);
            model.file5name   = string.IsNullOrEmpty(model.file5name) ? "" : GenerateToken.GetGuid() + Path.GetExtension(model.file5name);

            //Risk Group 1
            if (!model.riskgroup1)
            {
                model.riskgroup11      = false;
                model.riskgroup12      = false;
                model.riskgroup13      = false;
                model.riskgroup14      = false;
                model.riskgroup15      = false;
                model.riskgroup15other = string.Empty;
            }

            //Risk Group 2
            if (!model.riskgroup1)
            {
                model.riskgroup11 = false;
                model.riskgroup22 = false;
                model.riskgroup23 = false;
                model.riskgroup24 = false;
                model.riskgroup25 = false;
            }

            //Risk Group 3
            if (!model.riskgroup1)
            {
                model.riskgroup31 = false;
                model.riskgroup32 = false;
                model.riskgroup33 = false;
                model.riskgroup34 = false;
                model.riskgroup35 = false;
            }

            //Risk Group 4
            if (!model.riskgroup1)
            {
                model.riskgroup41 = false;
                model.riskgroup42 = false;
                model.riskgroup43 = false;
                model.riskgroup44 = false;
                model.riskgroup45 = false;
            }



            //Member Project 1
            MemberProject member1 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member1projecthead))
            {
                member1.projecthead = model.member1projecthead;
                member1.facultyname = model.member1facultyname;
                member1.workphone   = model.member1workphone;
                member1.mobile      = model.member1mobile;
                member1.fax         = model.member1fax;
                member1.email       = model.member1email;
                model.member1json   = member1;
            }
            //Member Project 2
            MemberProject member2 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member2projecthead))
            {
                member2.projecthead = model.member2projecthead;
                member2.facultyname = model.member2facultyname;
                member2.workphone   = model.member2workphone;
                member2.mobile      = model.member2mobile;
                member2.fax         = model.member2fax;
                member2.email       = model.member2email;
                model.member2json   = member2;
            }
            //Member Project 3
            MemberProject member3 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member3projecthead))
            {
                member3.projecthead = model.member3projecthead;
                member3.facultyname = model.member3facultyname;
                member3.workphone   = model.member3workphone;
                member3.mobile      = model.member3mobile;
                member3.fax         = model.member3fax;
                member3.email       = model.member3email;
                model.member3json   = member3;
            }
            //Member Project 4
            MemberProject member4 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member4projecthead))
            {
                member4.projecthead = model.member4projecthead;
                member4.facultyname = model.member4facultyname;
                member4.workphone   = model.member4workphone;
                member4.mobile      = model.member4mobile;
                member4.fax         = model.member4fax;
                member4.email       = model.member4email;
                model.member4json   = member4;
            }
            //Member Project 5
            MemberProject member5 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member5projecthead))
            {
                member5.projecthead = model.member5projecthead;
                member5.facultyname = model.member5facultyname;
                member5.workphone   = model.member5workphone;
                member5.mobile      = model.member5mobile;
                member5.fax         = model.member5fax;
                member5.email       = model.member5email;
                model.member5json   = member5;
            }
            //Member Project 6
            MemberProject member6 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member6projecthead))
            {
                member6.projecthead = model.member6projecthead;
                member6.facultyname = model.member6facultyname;
                member6.workphone   = model.member6workphone;
                member6.mobile      = model.member6mobile;
                member6.fax         = model.member6fax;
                member6.email       = model.member6email;
                model.member6json   = member6;
            }
            //Member Project 7
            MemberProject member7 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member7projecthead))
            {
                member7.projecthead = model.member7projecthead;
                member7.facultyname = model.member7facultyname;
                member7.workphone   = model.member7workphone;
                member7.mobile      = model.member7mobile;
                member7.fax         = model.member7fax;
                member7.email       = model.member7email;
                model.member7json   = member7;
            }
            //Member Project 8
            MemberProject member8 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member8projecthead))
            {
                member8.projecthead = model.member8projecthead;
                member8.facultyname = model.member8facultyname;
                member8.workphone   = model.member8workphone;
                member8.mobile      = model.member8mobile;
                member8.fax         = model.member8fax;
                member8.email       = model.member8email;
                model.member8json   = member8;
            }
            //Member Project 9
            MemberProject member9 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member9projecthead))
            {
                member9.projecthead = model.member9projecthead;
                member9.facultyname = model.member9facultyname;
                member9.workphone   = model.member9workphone;
                member9.mobile      = model.member9mobile;
                member9.fax         = model.member9fax;
                member9.email       = model.member9email;
                model.member9json   = member9;
            }
            //Member Project 10
            MemberProject member10 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member10projecthead))
            {
                member10.projecthead = model.member10projecthead;
                member10.facultyname = model.member10facultyname;
                member10.workphone   = model.member10workphone;
                member10.mobile      = model.member10mobile;
                member10.fax         = model.member10fax;
                member10.email       = model.member10email;
                model.member10json   = member10;
            }
            //Member Project 11
            MemberProject member11 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member11projecthead))
            {
                member11.projecthead = model.member11projecthead;
                member11.facultyname = model.member11facultyname;
                member11.workphone   = model.member11workphone;
                member11.mobile      = model.member11mobile;
                member11.fax         = model.member11fax;
                member11.email       = model.member11email;
                model.member11json   = member11;
            }
            //Member Project 12
            MemberProject member12 = new MemberProject();

            if (!string.IsNullOrEmpty(model.member12projecthead))
            {
                member12.projecthead = model.member12projecthead;
                member12.facultyname = model.member12facultyname;
                member12.workphone   = model.member12workphone;
                member12.mobile      = model.member12mobile;
                member12.fax         = model.member12fax;
                member12.email       = model.member12email;
                model.member12json   = member12;
            }


            var resp = await _IDocMenuA1Repository.AddDocMenuA1Async(model);

            if (resp.Status)
            {
                if (!string.IsNullOrEmpty(model.file1base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA1, model.file1name, model.file1base64);
                }
                if (!string.IsNullOrEmpty(model.file2base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA1, model.file2name, model.file2base64);
                }
                if (!string.IsNullOrEmpty(model.file3base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA1, model.file3name, model.file3base64);
                }
                if (!string.IsNullOrEmpty(model.file4base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA1, model.file4name, model.file4base64);
                }
                if (!string.IsNullOrEmpty(model.file5base64))
                {
                    ServerDirectorys.SaveFileFromBase64(_IEnvironmentConfig.PathDocument, FolderDocument.menuA1, model.file5name, model.file5base64);
                }
            }

            return(resp);
        }