コード例 #1
0
        public IEnumerable <AnsOP> TicketComment(AddComment data)
        {
            List <AnsOP> results = new List <AnsOP>();

            try
            {
                Ticket ticket = new Ticket();

                int oderNo = idOderno(data.TK_ID);

                using (TicketOPDataContext Context = new TicketOPDataContext())
                {
                    var trnTicketI = new TRN_TICKET_I();

                    trnTicketI.TK_ID     = data.TK_ID;
                    trnTicketI.TK_MESAGE = data.TK_MESAGE;
                    trnTicketI.ORDERNO   = (Int16)oderNo;
                    //trnTicketI.US_ID = idUser(userOnline);
                    trnTicketI.CREATEDATE = DateTime.Now;
                    trnTicketI.STCODE     = data.STCODE;

                    Context.TRN_TICKET_Is.InsertOnSubmit(trnTicketI);
                    //Context.SubmitChanges();

                    int tkId = data.TK_ID;
                    Context.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                AnsOP res = new AnsOP();
                res.status  = "F";
                res.message = ex.Message;
                results.Add(res);
            }

            return(results.ToArray());
        }
コード例 #2
0
        public IEnumerable <AnsOP> CreateTicket(CreTicket data)
        {
            List <AnsOP> results = new List <AnsOP>();

            try
            {
                Ticket ticket = new Ticket();

                using (TicketOPDataContext Context = new TicketOPDataContext())
                {
                    var queryX      = Context.MAS_WHs.Where(x => x.WHCODE == data.STCODE).FirstOrDefault();
                    var trnTicket   = new TRN_TICKET();
                    var trnTicket_f = new TRN_TICKET_F();
                    //var TmpTicket = new TRN_TICKET_TMP();

                    string tketNo = ticketNo(queryX.BRAND);

                    trnTicket.TICKETNO = tketNo;
                    trnTicket.WHCODE   = data.STCODE;
                    trnTicket.WHNAME   = data.WHNAME;
                    trnTicket.AREA     = data.AREA_NAME;
                    trnTicket.DETAIL   = data.DETAIL;
                    //trnTicket.JT_ID = newItem.JT_ID;
                    trnTicket.SS_ID = 1;

                    trnTicket.CREATEDATE = DateTime.Now;
                    trnTicket.FLAG       = "0";
                    Context.TRN_TICKETs.InsertOnSubmit(trnTicket);

                    Context.SubmitChanges();

                    var Detail = Context.TRN_TICKETs.Where(s => s.TICKETNO == tketNo).FirstOrDefault();

                    int tkId = Detail.TK_ID;
                    //Int16 oderNo = 0;
                    //string pathSet = "FilesUpload";

                    //if (Request.Files[0].ContentLength > 0)
                    //{
                    //    HttpPostedFileBase hpf_1 = Request.Files[0];
                    //    HttpPostedFileBase hpf_2 = Request.Files[1];
                    //    HttpPostedFileBase hpf_3 = Request.Files[2];

                    //    string fileName1 = "";
                    //    string fileName2 = "";
                    //    string fileName3 = "";
                    //    pathSet = "~/FilesUpload/";

                    //    if (hpf_1.FileName != null && hpf_1.FileName.Length > 0)
                    //    {
                    //        fileName1 = tketNo + "_" + tkId.ToString() + "_" + oderNo.ToString() + "_" + Path.GetFileName(hpf_1.FileName);
                    //        var path1 = Path.Combine(Server.MapPath("~/FilesUpload"), fileName1);
                    //        hpf_1.SaveAs(path1);

                    //        fileName1 = pathSet + fileName1;
                    //    }

                    //    if (hpf_2.FileName != null && hpf_2.FileName.Length > 0)
                    //    {
                    //        fileName2 = tketNo + "_" + tkId.ToString() + "_" + oderNo.ToString() + "_" + Path.GetFileName(hpf_2.FileName);
                    //        var path2 = Path.Combine(Server.MapPath("~/FilesUpload"), fileName2);
                    //        hpf_2.SaveAs(path2);

                    //        fileName2 = pathSet + fileName2;
                    //    }

                    //    if (hpf_3.FileName != null && hpf_3.FileName.Length > 0)
                    //    {
                    //        fileName3 = tketNo + "_" + tkId.ToString() + "_" + oderNo.ToString() + "_" + Path.GetFileName(hpf_3.FileName);
                    //        var path3 = Path.Combine(Server.MapPath("~/FilesUpload"), fileName3);
                    //        hpf_3.SaveAs(path3);

                    //        fileName3 = pathSet + fileName3;
                    //    }

                    //    trnTicket_f.TK_ID = tkId;
                    //    trnTicket_f.ORDERNO = oderNo;
                    //    trnTicket_f.FILENO = 1;
                    //    trnTicket_f.PATH1 = fileName1;
                    //    trnTicket_f.PATH2 = fileName2;
                    //    trnTicket_f.PATH3 = fileName3;

                    //    Context.TRN_TICKET_Fs.InsertOnSubmit(trnTicket_f);
                    //    Context.SubmitChanges();
                    //}
                }
            }
            catch (Exception ex)
            {
                AnsOP res = new AnsOP();
                res.status  = "F";
                res.message = ex.Message;
                results.Add(res);
            }

            return(results.ToArray());
        }