private TblDyeingOrderInvoiceHeader UpdateOrInsertDyeingOrderInvoiceHeader(TblDyeingOrderInvoiceHeader newRow, bool save, int index, out int outindex)
 {
     outindex = index;
     using (var context = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             var seqCode = SharedOperation.GetChainSetup("GlDyeingPostSequence");
             var seqProd = context.TblSequenceProductions.FirstOrDefault(w => w.Code == seqCode);
             newRow.Code = SharedOperation.HandelSequence(seqProd);
             context.TblDyeingOrderInvoiceHeaders.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in context.TblDyeingOrderInvoiceHeaders
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 SharedOperation.GenericUpdate(oldRow, newRow, context);
             }
         }
         context.SaveChanges();
         return(newRow);
     }
 }
示例#2
0
        public List <TblStyleAttachment> GetDocumentationFiles()
        {
            //   var uri =MapPath("~");
            var uri  = HttpContext.Current.Server.MapPath("~/");
            var temp = Path.Combine(uri, SharedOperation.GetChainSetup("DocumentationFolder"));


            var dInfo = new DirectoryInfo(@temp);    //your path

            FileInfo[] FilesList = dInfo.GetFiles(); //can filter here with appropriate extentions
            var        list      = new List <TblStyleAttachment>();

            foreach (var fileInfo in FilesList)
            {
                var newFile = new TblStyleAttachment();
                newFile.AttachmentPath        = SharedOperation.GetChainSetup("DocumentationFolder") + "/" + fileInfo.Name;
                newFile.AttachmentDescription = fileInfo.Name;
                newFile.OrginalFileName       = fileInfo.Name;
                list.Add(newFile);
            }
            return(list);//you can also return more generic xml
        }