예제 #1
0
        public ActionResult ShowPdfFile(long?d)
        {
            Documentm doc    = null;
            long      DocNum = 0;

            if (d != null)
            {
                DocNum = (long)d;
            }
            Patientm patm;

            if (Session["Patient"] == null)
            {
                return(RedirectToAction("Login"));
            }
            else
            {
                patm = (Patientm)Session["Patient"];
            }
            if (DocNum != 0)
            {
                doc = Documentms.GetOne(patm.CustomerNum, DocNum);
            }
            if (doc == null || patm.PatNum != doc.PatNum) //make sure that the patient does not pass the another DocNum of another patient.
            {
                return(new EmptyResult());                //return a blank page todo: return page with proper message.
            }
            ContentDisposition cd = new ContentDisposition();

            cd.Inline = true;          //the browser will try and show the pdf inline i.e inside the browser window. If set to false it will force a download.
            Response.AppendHeader("Content-Disposition", cd.ToString());
            return(File(Convert.FromBase64String(doc.RawBase64), "application/pdf", "Statement.pdf"));
        }
예제 #2
0
        ///<summary>Converts one Document object to its mobile equivalent.  Warning! CustomerNum will always be 0.</summary>
        internal static Documentm ConvertToM(Document document)
        {
            Documentm documentm = new Documentm();

            //CustomerNum cannot be set.  Remains 0.
            documentm.DocNum    = document.DocNum;
            documentm.PatNum    = document.PatNum;
            documentm.RawBase64 = document.RawBase64;
            return(documentm);
        }
예제 #3
0
파일: DocumentmCrud.cs 프로젝트: mnisl/OD
		///<summary>Updates one Documentm in the database.</summary>
		internal static void Update(Documentm documentm){
			string command="UPDATE documentm SET "
				+"PatNum     =  "+POut.Long  (documentm.PatNum)+", "
				+"RawBase64  =  "+DbHelper.ParamChar+"paramRawBase64 "
				+"WHERE CustomerNum = "+POut.Long(documentm.CustomerNum)+" AND DocNum = "+POut.Long(documentm.DocNum);
			if(documentm.RawBase64==null) {
				documentm.RawBase64="";
			}
			OdSqlParameter paramRawBase64=new OdSqlParameter("paramRawBase64",OdDbType.Text,documentm.RawBase64);
			Db.NonQ(command,paramRawBase64);
		}
예제 #4
0
파일: DocumentmCrud.cs 프로젝트: mnisl/OD
		///<summary>Converts a DataTable to a list of objects.</summary>
		internal static List<Documentm> TableToList(DataTable table){
			List<Documentm> retVal=new List<Documentm>();
			Documentm documentm;
			for(int i=0;i<table.Rows.Count;i++) {
				documentm=new Documentm();
				documentm.CustomerNum= PIn.Long  (table.Rows[i]["CustomerNum"].ToString());
				documentm.DocNum     = PIn.Long  (table.Rows[i]["DocNum"].ToString());
				documentm.PatNum     = PIn.Long  (table.Rows[i]["PatNum"].ToString());
				documentm.RawBase64  = PIn.String(table.Rows[i]["RawBase64"].ToString());
				retVal.Add(documentm);
			}
			return retVal;
		}
예제 #5
0
        ///<summary>Updates one Documentm in the database.</summary>
        internal static void Update(Documentm documentm)
        {
            string command = "UPDATE documentm SET "
                             + "PatNum     =  " + POut.Long(documentm.PatNum) + ", "
                             + "RawBase64  =  " + DbHelper.ParamChar + "paramRawBase64 "
                             + "WHERE CustomerNum = " + POut.Long(documentm.CustomerNum) + " AND DocNum = " + POut.Long(documentm.DocNum);

            if (documentm.RawBase64 == null)
            {
                documentm.RawBase64 = "";
            }
            OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, documentm.RawBase64);

            Db.NonQ(command, paramRawBase64);
        }
예제 #6
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <Documentm> TableToList(DataTable table)
        {
            List <Documentm> retVal = new List <Documentm>();
            Documentm        documentm;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                documentm             = new Documentm();
                documentm.CustomerNum = PIn.Long(table.Rows[i]["CustomerNum"].ToString());
                documentm.DocNum      = PIn.Long(table.Rows[i]["DocNum"].ToString());
                documentm.PatNum      = PIn.Long(table.Rows[i]["PatNum"].ToString());
                documentm.RawBase64   = PIn.String(table.Rows[i]["RawBase64"].ToString());
                retVal.Add(documentm);
            }
            return(retVal);
        }
예제 #7
0
파일: DocumentmCrud.cs 프로젝트: mnisl/OD
		///<summary>Usually set useExistingPK=true.  Inserts one Documentm into the database.</summary>
		internal static long Insert(Documentm documentm,bool useExistingPK){
			if(!useExistingPK) {
				documentm.DocNum=ReplicationServers.GetKey("documentm","DocNum");
			}
			string command="INSERT INTO documentm (";
			command+="DocNum,";
			command+="CustomerNum,PatNum,RawBase64) VALUES(";
			command+=POut.Long(documentm.DocNum)+",";
			command+=
				     POut.Long  (documentm.CustomerNum)+","
				+    POut.Long  (documentm.PatNum)+","
				+DbHelper.ParamChar+"paramRawBase64)";
			if(documentm.RawBase64==null) {
				documentm.RawBase64="";
			}
			OdSqlParameter paramRawBase64=new OdSqlParameter("paramRawBase64",OdDbType.Text,documentm.RawBase64);
			Db.NonQ(command,paramRawBase64);//There is no autoincrement in the mobile server.
			return documentm.DocNum;
		}
예제 #8
0
        ///<summary>Usually set useExistingPK=true.  Inserts one Documentm into the database.</summary>
        internal static long Insert(Documentm documentm, bool useExistingPK)
        {
            if (!useExistingPK)
            {
                documentm.DocNum = ReplicationServers.GetKey("documentm", "DocNum");
            }
            string command = "INSERT INTO documentm (";

            command += "DocNum,";
            command += "CustomerNum,PatNum,RawBase64) VALUES(";
            command += POut.Long(documentm.DocNum) + ",";
            command +=
                POut.Long(documentm.CustomerNum) + ","
                + POut.Long(documentm.PatNum) + ","
                + DbHelper.ParamChar + "paramRawBase64)";
            if (documentm.RawBase64 == null)
            {
                documentm.RawBase64 = "";
            }
            OdSqlParameter paramRawBase64 = new OdSqlParameter("paramRawBase64", OdDbType.Text, documentm.RawBase64);

            Db.NonQ(command, paramRawBase64);           //There is no autoincrement in the mobile server.
            return(documentm.DocNum);
        }
예제 #9
0
파일: DocumentmCrud.cs 프로젝트: mnisl/OD
		///<summary>Converts one Document object to its mobile equivalent.  Warning! CustomerNum will always be 0.</summary>
		internal static Documentm ConvertToM(Document document){
			Documentm documentm=new Documentm();
			//CustomerNum cannot be set.  Remains 0.
			documentm.DocNum     =document.DocNum;
			documentm.PatNum     =document.PatNum;
			documentm.RawBase64  =document.RawBase64;
			return documentm;
		}