Example #1
0
        public static int Update(Agents A)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", A.ID);
            AddParms(ref db, A);

            int retval = db.ExecuteNonQuery(_SQLUpdate);

            AddLog(Status: "AED", Logtext: string.Format("Update AED: ID:{0} Name:{1} ", A.ID, A.Name), Metode: "Update");
            return(retval);
        }
Example #2
0
        public static Agents GetAgentsByCode(Guid AgentID)
        {
            DBAccess db = new DBAccess();

            db.AddGuid("AgentID", AgentID);
            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByAgentGUID));

            if (dr.HasRows) //SqlDataReader
            {
                Agents c = new Agents();
                while (dr.Read())
                {
                    Populate(dr, c);
                }
                dr.Close();
                return(c);
            }
            else
            {
                dr.Close();
                return(null);
            }
        }
Example #3
0
        public static Agents GetAgents(int ID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", ID);
            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectOne));

            if (dr.HasRows)
            {
                Agents c = new Agents();
                while (dr.Read())
                {
                    Populate(dr, c);
                }
                dr.Close();
                return(c);
            }
            else
            {
                dr.Close();
                return(null);
            }
        }
Example #4
0
        public static string Tags(string tekst, RescueTekniq.BOL.Agents item)
        {
            StringBuilder sb = new StringBuilder();

            tekst = (tekst + " ").Trim();
            if (item.loaded)
            {
                sb.Append(tekst);
                sb.Replace("[AGENT.CODE]", item.AgentID.ToString());
                sb.Replace("[AGENT.GUID]", item.AgentID.ToString());

                sb.Replace("[AGENT.COMPANY]", item.CompanyName);
                sb.Replace("[AGENT.COMPANYNAME]", item.CompanyName);
                sb.Replace("[AGENT.TITLE]", item.Title);
                sb.Replace("[AGENT.NAME]", item.Name);
                sb.Replace("[AGENT.FIRSTNAME]", item.FirstName);
                sb.Replace("[AGENT.LASTNAME]", item.LastName);

                sb.Replace("[AGENT.ADDRESS]", System.Convert.ToString(item.Address1 + "  " + System.Convert.ToString(item.Address2.Trim() != "" ? "<br />" + Constants.vbNewLine + item.Address2 : "")));
                sb.Replace("[AGENT.ADDRESS1]", item.Address1);
                sb.Replace("[AGENT.ADDRESS2]", item.Address2);
                sb.Replace("[AGENT.ZIPCODECITY]", item.CityZipCodeState);
                sb.Replace("[AGENT.CITY]", item.City);
                sb.Replace("[AGENT.ZIPCODE]", item.ZipCode);
                sb.Replace("[AGENT.STATE]", item.State);
                sb.Replace("[AGENT.COUNTRY]", item.Country);

                sb.Replace("[AGENT.EMAIL]", item.Email);
                sb.Replace("[AGENT.ORDREEMAIL]", item.OrdreEmail);

                sb.Replace("[AGENT.PHONE]", item.Phone);
                sb.Replace("[AGENT.CELLPHONE]", item.CellPhone);
                sb.Replace("[AGENT.FAX]", item.Fax);
                tekst = sb.ToString();
            }
            return(tekst); //sb.ToString
        }
Example #5
0
        public static int Insert(Agents A)
        {
            DBAccess db = new DBAccess();

            AddParms(ref db, A);

            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);
            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                A.ID = Funktioner.ToInt(objParam.Value, -1);
                AddLog(Status: "Agents", Logtext: string.Format("Create Agent: ID:{0} Name:{1} ", A.ID, A.Name), Metode: "Insert");
                return(A.ID);
            }
            else
            {
                AddLog(Status: "Agents", Logtext: string.Format("Failure to Create Agent: Name:{0}", A.Name), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
Example #6
0
        public static int Delete(int ID)
        {
            Agents item = new Agents(ID);

            return(Delete(item));
        }