Esempio n. 1
0
        public long Insert(DocumentDTO entity)
        {
            document.AddOutputParameters("@id", entity.docID);
            document.AddInputParameters("@docContentType", entity.docContentType);
            document.AddInputParameters("@docRegNo", entity.docRegNo);

            if (entity.docRegDate == null)
            {
                entity.docRegDate = DateTime.Now.ToString("dd/MM/yyyy");
            }
            document.AddInputParameters("@docRegDate", DateTime.ParseExact(entity.docRegDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture));

            document.AddInputParameters("@docDayCount", entity.docDayCount);

            if (entity.docFinishDate == null)
            {
                entity.docFinishDate = DateTime.Now.ToString("dd/MM/yyyy");
            }
            document.AddInputParameters("@docFinishDate", DateTime.ParseExact(entity.docFinishDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture));

            document.AddInputParameters("@docType", entity.docType);
            document.AddInputParameters("@docContent", entity.docContent);
            document.AddInputParameters("@docNote", entity.docNote);
            document.AddInputParameters("@docInCharge", entity.docInCharge);
            document.AddInputParameters("@belongToDoc", entity.belongToDoc);
            document.IUD("sp_Document_Insert", CommandType.StoredProcedure);
            return(Convert.ToInt64(document.GetParamValue("@id")));
        }