Esempio n. 1
0
		///<summary>Updates one Userm in the database.</summary>
		internal static void Update(Userm userm){
			string command="UPDATE userm SET "
				+"UserName   = '******', "
				+"Password   = '******' "
				+"WHERE CustomerNum = "+POut.Long(userm.CustomerNum)+" AND UsermNum = "+POut.Long(userm.UsermNum);
			Db.NonQ(command);
		}
Esempio n. 2
0
        public long GetDentalOfficeID(string username, string password)
        {
            long   DentalOfficeID = 0;
            String md5password    = new WebHostSynch.Util().MD5Encrypt(password);

            try {
                // a query involving both username and password is used because 2 dental offices could potentially have the same username
                String command = "SELECT * FROM userm WHERE UserName='******' AND Password='******'";
                Userm  um      = Userms.GetOne(command);
                if (um == null)
                {
                    DentalOfficeID = 0;                  //user password combination incorrect- specify message if necessary
                }
                else
                {
                    DentalOfficeID = um.CustomerNum;
                }
            }
            catch (Exception ex) {
                Logger.LogError(ex);
                return(DentalOfficeID);
            }
            if (username.ToLower() == "demo")           //for demo only
            {
                DentalOfficeID = GetDemoDentalOfficeID();
            }
            return(DentalOfficeID);
        }
Esempio n. 3
0
        public void SetMobileWebUserPassword(long customerNum, String UserName, String Password)
        {
            Userm um         = Userms.GetOne(customerNum, 1);
            bool  UserExists = true;

            if (um == null)
            {
                um         = new Userm();
                UserExists = false;
            }
            um.CustomerNum = customerNum;
            um.UsermNum    = 1;       //always 1
            um.UserName    = UserName;
            if (Password != "")       //do not update password if password string is empty
            {
                um.Password = MD5Encrypt(Password);
            }
            if (UserExists)
            {
                Userms.Update(um);
            }
            else
            {
                Userms.Insert(um);
            }
        }
Esempio n. 4
0
        ///<summary>Updates one Userm in the database.</summary>
        internal static void Update(Userm userm)
        {
            string command = "UPDATE userm SET "
                             + "UserName   = '******', "
                             + "Password   = '******' "
                             + "WHERE CustomerNum = " + POut.Long(userm.CustomerNum) + " AND UsermNum = " + POut.Long(userm.UsermNum);

            Db.NonQ(command);
        }
Esempio n. 5
0
        public string GetMobileWebUserName(long customerNum)
        {
            String UserName = "";
            Userm  um       = Userms.GetOne(customerNum, 1);

            if (um != null)
            {
                UserName = um.UserName;
            }
            return(UserName);
        }
Esempio n. 6
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		internal static List<Userm> TableToList(DataTable table){
			List<Userm> retVal=new List<Userm>();
			Userm userm;
			for(int i=0;i<table.Rows.Count;i++) {
				userm=new Userm();
				userm.CustomerNum= PIn.Long  (table.Rows[i]["CustomerNum"].ToString());
				userm.UsermNum   = PIn.Long  (table.Rows[i]["UsermNum"].ToString());
				userm.UserName   = PIn.String(table.Rows[i]["UserName"].ToString());
				userm.Password   = PIn.String(table.Rows[i]["Password"].ToString());
				retVal.Add(userm);
			}
			return retVal;
		}
Esempio n. 7
0
		///<summary>Usually set useExistingPK=true.  Inserts one Userm into the database.</summary>
		internal static long Insert(Userm userm,bool useExistingPK){
			if(!useExistingPK) {
				userm.UsermNum=ReplicationServers.GetKey("userm","UsermNum");
			}
			string command="INSERT INTO userm (";
			command+="UsermNum,";
			command+="CustomerNum,UserName,Password) VALUES(";
			command+=POut.Long(userm.UsermNum)+",";
			command+=
				     POut.Long  (userm.CustomerNum)+","
				+"'"+POut.String(userm.UserName)+"',"
				+"'"+POut.String(userm.Password)+"')";
			Db.NonQ(command);//There is no autoincrement in the mobile server.
			return userm.UsermNum;
		}
Esempio n. 8
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <Userm> TableToList(DataTable table)
        {
            List <Userm> retVal = new List <Userm>();
            Userm        userm;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                userm             = new Userm();
                userm.CustomerNum = PIn.Long(table.Rows[i]["CustomerNum"].ToString());
                userm.UsermNum    = PIn.Long(table.Rows[i]["UsermNum"].ToString());
                userm.UserName    = PIn.String(table.Rows[i]["UserName"].ToString());
                userm.Password    = PIn.String(table.Rows[i]["Password"].ToString());
                retVal.Add(userm);
            }
            return(retVal);
        }
Esempio n. 9
0
        ///<summary>Usually set useExistingPK=true.  Inserts one Userm into the database.</summary>
        internal static long Insert(Userm userm, bool useExistingPK)
        {
            if (!useExistingPK)
            {
                userm.UsermNum = ReplicationServers.GetKey("userm", "UsermNum");
            }
            string command = "INSERT INTO userm (";

            command += "UsermNum,";
            command += "CustomerNum,UserName,Password) VALUES(";
            command += POut.Long(userm.UsermNum) + ",";
            command +=
                POut.Long(userm.CustomerNum) + ","
                + "'" + POut.String(userm.UserName) + "',"
                + "'" + POut.String(userm.Password) + "')";
            Db.NonQ(command);            //There is no autoincrement in the mobile server.
            return(userm.UsermNum);
        }