public static void addAgentController() { AgentController objAgentController = new AgentController(); AgentModel objModel = new AgentModel(); objModel.Address1 = "CARVAJAL SANTA MONICA"; //objAgentController.createAgent(objModel); }
/// <summary> /// Allow create a new agent /// </summary> /// <param name="model"> Objet type ModelAgent</param> /// <param name="prmOutIdAgent">New id agent record</param> /// <param name="prmOutResult">Result the process created</param> public void addAgentController(AgentModel model, ref ObjectParameter prmOutIdAgent, ref ObjectParameter prmOutResult) { int res = 0; Repository<AGENT> objInsert = new Repository<AGENT>(); //Repository<AgentInsert> objInsert = new Repository<AgentInsert>(); DGSDATAEntities entities = new DGSDATAEntities(); try { res = entities.Agent_Insert( model.Enable, model.DontXferPlayerActivity, //prmDontXfer model.IsDistributor, model.IdUser, // prmIdUser, model.Distributor, model.Makeup, model.CommSports, model.CommCasino, model.CommHorses, model.PerHeadSports, model.PerHeadCasino, model.PerHeadHorses, model.IdAgentType, model.IdCurrency, model.IdBook, model.IdGrouping, model.Agent, model.Name, model.Password, model.City, model.State, model.Country, model.Address1, model.Address2, model.Email, model.Phone, model.Fax, model.Zip, model.OnlineAccess, model.OnlineMessage, model.IdLineType, prmOutIdAgent, prmOutResult); //object obj = new object[] { prmOutIdAgent, prmOutResult }; //return obj; } catch { throw; } }
public void createAgent(AgentModel model) { Repository<AgentInsert> objInsert = new Repository<AgentInsert>(); DGSDATAEntities entities = new DGSDATAEntities(); try { object obj = new object(); obj = entities.Agent_Insert(true, true, true, 1, 1.0, 1, 1, 1, 2.0, 3.0, 4.0, 3, 4, 2, 1, "", "name", "pass", "city", "state", "coontry", "addres1", "addres2", "email" , "", "", "zip", true, "", obj); var result = entities.Agent_Insert(model.Enable, model.DontXferPlayerActivity, model.IsDistributor, model.IdUser, model.Makeup, model.CommSports, model.CommCasino, model.CommHorses, model.PerHeadSports, model.PerHeadCasino, model.PerHeadHorses, model.IdAgentType, model.IdCurrency, model.IdBook, model.IdGrouping, model.Agent, model.Name, model.Password, model.City, model.State, model.Country, model.Address1, model.Address2, model.Email, model.Phone, model.Fax, model.Zip, model.OnlineAccess, model.OnlineMessage, null ); } catch (Exception exc) { throw; } }
public string addAgentFacade(AgentModel agentModel) { responseOperation = new MessageInfo(); try { //Add arguments to list List<keyValue> lstParams = new List<keyValue>(); //lstParams.Add(new keyValue("agent", agent)); lstParams.Add(new keyValue("idUser", idUser)); string method = string.Format("{0}.{1}", MethodBase.GetCurrentMethod().DeclaringType.FullName, MethodBase.GetCurrentMethod().Name); ObjectParameter prmOutIdAgent = new ObjectParameter("prmOutIdAgent", typeof(int)); ObjectParameter prmOutResult = new ObjectParameter("prmOutResult", typeof(int)); objController.addAgentController(agentModel, ref prmOutIdAgent, ref prmOutResult); int op = Int32.Parse(prmOutResult.Value.ToString()); switch (op) { case 0: responseOperation.messageID = 100; break; case -1: responseOperation.messageID = 101; break; case -2: responseOperation.messageID = 102; break; case -3: responseOperation.messageID = 103; break; } DataMessage.ObtenerMensaje(responseOperation); responseOperation.MessageLog = string.Format(" It was created on record [Agent] with ID :", Int32.Parse(prmOutIdAgent.Value.ToString())); Log4NetHelper.addLog(Log4NetHelper.levelLog.INFO, string.Format(" It was created on record [Agent] with ID :", prmOutIdAgent.ToString())); return JavaScriptSerializerHelper.GetString(new object[] { responseOperation, null }); } catch (Exception exc) { responseOperation.messageID = 3; responseOperation.MessageLog = exc.ToString(); DataMessage.ObtenerMensaje(responseOperation); Log4NetHelper.addLog(Log4NetHelper.levelLog.ERROR, "An exception is presented .", exc); return JavaScriptSerializerHelper.GetString(new object[] { responseOperation, null }); } }
/// <summary> /// /// </summary> /// <param name="agentModel"></param> public void addAgent(AgentModel agentModel) { }
public static void Main(string[] args) { #region AgentModel AgentModel objModel = new AgentModel(); objModel.IdAgent = 10013; objModel.IdCurrency = 328; objModel.IdBook = 607; objModel.Agent = "SaLoSanchez"; objModel.IdAgentType = 254; objModel.IdGrouping = 742; objModel.Distributor = 596; objModel.Password = "******"; objModel.Enable = false; objModel.Name = "SaLoSanchez"; objModel.Address1 = "CARVAJAL SANTA MONICA"; objModel.Address2 = "CARVAJAL SANTA MONICA"; objModel.City = "Cali"; objModel.State = "Valle del cauca"; objModel.Country = "Colombia"; objModel.Zip = "760001"; objModel.Phone = "3113585328"; objModel.Fax = "3113585328"; objModel.Email = "*****@*****.**"; objModel.IsDistributor = true; objModel.CommSports = 167; objModel.CommCasino = 39; objModel.CommHorses = 166; objModel.PerHeadSports = 0; objModel.PerHeadCasino = 1473147; objModel.PerHeadHorses = 10000; objModel.OnlineAccess = true; objModel.OnlineMessage = "Message"; //objModel.LastModification = "2015-11-06 17:54:51"; objModel.LastModificationUser = 2; objModel.IdLineType = 131; #endregion //stDGSServices.DGSService. DGSServiceClient.DGSService.DGSWCFServiceClient objDGSServiceClient = new DGSService.DGSWCFServiceClient(); BookModel objModelBook = new BookModel(); objModelBook.Description = "TEST"; objModelBook.IdWebColumn = 4; objModelBook.LastModificationUser = 2; objDGSServiceClient.addAgentService(objModel); BookFacade BookFacade1 = new BookFacade(); //BookFacade1.addBookFacade(objModelBook); //const string WEBSERVICE_URL = "http://localhost:16688/DGSWCFService.svc/addBook"; //string jsonData = "{ \"key1\" : \"value1\", \"key2\":\"value2\" }"; //try //{ // var webRequest = System.Net.WebRequest.Create(WEBSERVICE_URL); // if (webRequest != null) // { // webRequest.Method = "POST"; // webRequest.Timeout = 20000; // webRequest.ContentType = "application/json"; // using (System.IO.Stream s = webRequest.GetRequestStream()) // { // using (System.IO.StreamWriter sw = new System.IO.StreamWriter(s)) // sw.Write(jsonData); // } // using (System.IO.Stream s = webRequest.GetResponse().GetResponseStream()) // { // using (System.IO.StreamReader sr = new System.IO.StreamReader(s)) // { // var jsonResponse = sr.ReadToEnd(); // System.Diagnostics.Debug.WriteLine(String.Format("Response: {0}", jsonResponse)); // } // } // } //} //catch (Exception ex) //{ // System.Diagnostics.Debug.WriteLine(ex.ToString()); //} //DGSServiceClient.DGSService.DGSWCFServiceClient objDGSServiceClient = new DGSService.DGSWCFServiceClient(); //var result = objDGSServiceClient.agentGetInfoService("LUFKIN", "2"); }
public string updateAgentFacade(AgentModel agentModel) { responseOperation = new MessageInfo(); try { objController.updateAgentController(agentModel); responseOperation.messageID = 1; DataMessage.ObtenerMensaje(responseOperation); responseOperation.MessageLog = string.Format(" It was updated on record [Agent] with ID :", agentModel.IdAgent.ToString()); Log4NetHelper.addLog(Log4NetHelper.levelLog.INFO, string.Format(" It was updated on record [Agent] with ID :", agentModel.IdAgent.ToString())); return JavaScriptSerializerHelper.GetString(new object[] { responseOperation, null }); } catch (Exception exc) { responseOperation.messageID = 3; responseOperation.MessageLog = exc.ToString(); DataMessage.ObtenerMensaje(responseOperation); Log4NetHelper.addLog(Log4NetHelper.levelLog.ERROR, "An exception is presented .", exc); return JavaScriptSerializerHelper.GetString(new object[] { responseOperation, null }); } }
/// <summary> /// Allow update a record the agent /// </summary> /// <param name="model"></param> public int updateAgentController (AgentModel model) { int res = 0; DGSDATAEntities entities = new DGSDATAEntities(); try { res = entities.Agent_Update( model.IdAgent , model.Enable , model.DontXferPlayerActivity,//prmDontXfer model.IsDistributor , model.IdUser , model.Distributor , model.Makeup , model.CommSports , model.CommCasino , model.CommHorses , model.PerHeadSports , model.PerHeadCasino , model.PerHeadHorses , model.IdAgentType , model.IdCurrency , model.IdBook , model.IdGrouping , model.Agent , model.Name , model.Password , model.City , model.State , model.Country , model.Address1 , model.Address2 , model.Email , model.Phone , model.Fax , model.Zip , model.OnlineAccess, model.OnlineMessage , model.IdLineType ); return res; } catch { throw; } }
/// <summary> /// /// </summary> /// <param name="agentModel"></param> /// <returns></returns> public string addAgentService(AgentModel agentModel) { return objAgentFacade.addAgentFacade(agentModel); }
/// <summary> /// /// </summary> /// <param name="agentModel"></param> public string updateAgentService(AgentModel agentModel) { return objAgentFacade.updateAgentFacade(agentModel); }