示例#1
0
        public static bool LoadNewDeal(string sPath, string sStatus)
        {
            //Variables
            XmlDocument doc = new XmlDocument();

            doc.Load(sPath);
            XmlNodeList xmlJobs = doc.GetElementsByTagName("command");
            //Deal Import Variables
            string     sOrgName = "";
            string     sTitle   = "";
            string     sValue   = "";
            string     sRep     = "";
            string     sPerson  = "";
            string     sEmail   = "";
            DealStatus dsStatus = new DealStatus {
                Status = DealStatus.dealStatus.Open
            };

            if (xmlJobs.Count <= 0)
            {
                Console.WriteLine("ERROR:");
                Console.WriteLine("There are no Jobs in the specified XML file.");
                Console.ReadLine();
                return(true);
            }
            else
            {
                //Set the Deal Import Variables
                sOrgName = xmlJobs[0].SelectSingleNode("org_name").InnerText;
                sTitle   = xmlJobs[0].SelectSingleNode("title").InnerText;
                sValue   = xmlJobs[0].SelectSingleNode("value").InnerText;
                sRep     = xmlJobs[0].SelectSingleNode("rep").InnerText;
                sPerson  = xmlJobs[0].SelectSingleNode("client_name").InnerText;
                sEmail   = xmlJobs[0].SelectSingleNode("email").InnerText;

                //Load global Deal object with values from FileMaker import
                g_User          = new UserAPI(sRep);
                g_Deal.stage_id = g_User.GetStage();
                g_Deal.title    = sTitle;
                g_Deal.value    = sValue.Replace("$", "");
                //g_Deal.org_id = GetOrgID(sOrgName);
                if (sEmail.Contains(";"))
                {
                    sEmail = sEmail.Substring(0, sEmail.IndexOf(";"));
                }
                g_Deal.person_id = GetPersonID(sEmail);
                //Hard Coded values for the Deal
                g_Deal.add_time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                g_Deal.status   = dsStatus.StatusText;

                if (DealExists(sTitle))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
示例#2
0
        public void Delete(DealStatus dealStatus)
        {
            var existed = _context.DealStatuses.Find(dealStatus.Id);

            _context.DealStatuses.Remove(existed);

            _context.SaveChanges();
        }
示例#3
0
 public DealStatus UpdateDealStatus(int dealId, DealStatus status)
 {
     if (status == DealStatus.Delivered)
     {
         dealRepository.DeliveryDeal(dealId);
     }
     dealRepository.UpdateDealStatus(dealId, status);
     return(status);
 }
示例#4
0
        public int UpdateDealStatus(int submitId, DealStatus dealStatus)
        {
            var dbCommand = _dbHelper.GetStoredProcCommand(SP_ModifyDealStatus);
            _dbHelper.AddInParameter(dbCommand, "@SubmitId", System.Data.DbType.Int32, submitId);
            _dbHelper.AddInParameter(dbCommand, "@DealStatus", System.Data.DbType.Int32, dealStatus);
            _dbHelper.AddInParameter(dbCommand, "@ModifiedDate", System.Data.DbType.DateTime, DateTime.Now);

            return _dbHelper.ExecuteNonQuery(dbCommand);
        }
示例#5
0
        public void Update(DealStatus dealStatus)
        {
            var existed = _context
                          .DealStatuses.Find(dealStatus.Id);

            existed.Name = dealStatus.Name;

            _context.SaveChanges();
        }
示例#6
0
        public IEnumerable<Deal> Get(DealStatus dealStatus)
        {
            var url = "deals.xml?status=" + dealStatus.ToString().ToLower();
            var response = _client.Execute<List<Deal>>(new RestRequest(url, Method.GET));
            var deals = response.Data;

            foreach (var deal in deals)
                deal.LoadParties(response.Content);

            return deals;
        }
示例#7
0
        public IEnumerable <Deal> Get(DealStatus dealStatus)
        {
            var url      = "deals.xml?status=" + dealStatus.ToString().ToLower();
            var response = Client.Execute <List <Deal> >(new RestRequest(url, Method.GET));
            var deals    = response.Data;

            foreach (var deal in deals)
            {
                deal.LoadParties(response.Content);
            }

            return(deals);
        }
示例#8
0
        public bool UpdateStatus(int id, DealStatus dealStatus)
        {
            var request = new RestRequest(String.Format("deals/{0}/status.xml", id), Method.PUT)
            {
                XmlSerializer = new XmlIgnoreSerializer()
            };

            request.AddParameter("text/xml", String.Format("<status><name>{0}</name></status>", dealStatus.ToString().ToLower()), ParameterType.RequestBody);

            var response = Client.Execute(request);

            return(response.StatusCode == HttpStatusCode.OK);
        }
示例#9
0
 public IHttpActionResult UpdateDealStatus(int dealId, int dealStatus)
 {
     try
     {
         if (dealStatus <= 0 || dealStatus > 4)
         {
             return(BadRequest($"Deal status incorrect"));
         }
         DealStatus status = (DealStatus)dealStatus;
         return(Ok(dealService.UpdateDealStatus(dealId, status)));
     }
     catch (InvalidOperationException)
     {
         return(BadRequest($"Deal with id {dealId} does not exists"));
     }
 }
示例#10
0
        public static void CreateDeal()
        {
            //Variables
            string      sAPIToken = g_User.APIKey;
            string      sURL      = @"https://mcrae2.pipedrive.com/v1/deals?api_token=" + sAPIToken;
            RestClient  rcClient  = new RestClient(sURL);
            RestRequest rrRequest = new RestRequest(Method.POST);
            DealStatus  dsStatus  = new DealStatus {
                Status = DealStatus.dealStatus.Open
            };

            //Execute Request
            try
            {
                //Add Header and Parameters
                rrRequest.AddJsonBody(g_Deal);

                //Execute Request
                IRestResponse <dynamic> rrResponse = rcClient.Execute <dynamic>(rrRequest);

                //Get response from API
                dynamic dResponse = JObject.Parse(rrResponse.Content);
                string  s         = dResponse.data.ToString();
                dynamic dDeal     = JObject.Parse(dResponse.data.ToString());

                Console.WriteLine();
                Console.WriteLine("Deal created successfully.");
                Console.WriteLine("Press Enter to close this window.");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR:\n\tFunction: CreateDeal()");
                Console.WriteLine("\t" + ex.Message);
                Console.ReadLine();
                Environment.Exit(-1);
            }
        }
示例#11
0
 public int UpdateDealStatus(int submitId, DealStatus dealStatus)
 {
     Tracking(ActionType.Edit, ResourceType.EntrustCommand, submitId, dealStatus.ToString());
     return(_entrustcmddao.UpdateDealStatus(submitId, dealStatus));
 }
示例#12
0
        public void Insert(DealStatus dealStatus)
        {
            _context.DealStatuses.Add(dealStatus);

            _context.SaveChanges();
        }
示例#13
0
 public void SetStatus(DealStatus status)
 {
     Status = status;
 }
 public static string GetDealName(DealStatus status)
 {
     return(EnumAttributeHelper.GetEnumDescription <DealStatus>(status));
 }
示例#15
0
        public static void UpdateStatus(int dealId, DealStatus status)
        {
            var deliveryDeal = deals.First(x => x.ID == dealId);

            deliveryDeal.DealStatus = status;
        }
 public DealStatus UpdateDealStatus(int dealId, DealStatus status)
 {
     DealContainer.UpdateStatus(dealId, status);
     return(status);
 }
示例#17
0
        public bool UpdateStatus(int id, DealStatus dealStatus)
        {
            var request = new RestRequest(String.Format("deals/{0}/status.xml", id), Method.PUT) { XmlSerializer = new XmlIgnoreSerializer() };
            request.AddParameter("text/xml", String.Format("<status><name>{0}</name></status>", dealStatus.ToString().ToLower()), ParameterType.RequestBody);

            var response = _client.Execute(request);
            return response.StatusCode == HttpStatusCode.OK;
        }