Example #1
0
        public MsCrmResult ConfirmForm(string token, int formCode)
        {
            MsCrmResult returnValue = new MsCrmResult();

            LoginSession ls = new LoginSession();

            try
            {
                _sda = new SqlDataAccess();
                _sda.openConnection(Globals.ConnectionString);

                #region | CHECK SESSION |
                MsCrmResultObject sessionResult = GetUserSession(token);

                if (!sessionResult.Success)
                {
                    returnValue.Result = sessionResult.Result;
                    return(returnValue);
                }
                else
                {
                    ls = (LoginSession)sessionResult.ReturnObject;
                }

                #endregion

                MsCrmResultObject resultFormInfo = DiscoveryFormHelper.GetDiscoveryFormInfo(formCode, _sda);

                if (resultFormInfo.Success)
                {
                    DiscoveryForm formInfo = (DiscoveryForm)resultFormInfo.ReturnObject;

                    formInfo.Status = new OptionSetValueWrapper()
                    {
                        AttributeValue = (int)DiscoveryFormStatus.LotusConfirmed
                    };

                    DiscoveryFormHelper.UpdateDiscoveryForm(formInfo, _service);
                }
                else
                {
                    returnValue.Result = resultFormInfo.Result;
                }
            }
            catch (Exception ex)
            {
                returnValue.Result = ex.Message;
            }

            return(returnValue);
        }
Example #2
0
        private void ProcessForms()
        {
            MsCrmResultObject resultRequestList = DiscoveryFormHelper.GetGiftReuqestListByStatus(DiscoveryFormStatus.Waiting, _sda);

            if (resultRequestList.Success)
            {
                try
                {
                    List <DiscoveryForm> lstForms = resultRequestList.GetReturnObject <List <DiscoveryForm> >();

                    FileLogHelper.LogFunction(this.GetType().Name, "DiscoveryFormCount:" + lstForms.Count.ToString(), @Globals.FileLogPath);

                    foreach (DiscoveryForm form in lstForms)
                    {
                        MsCrmResult result = SendToService(form);

                        if (result.Success)
                        {
                            form.Status = new OptionSetValueWrapper()
                            {
                                AttributeValue = (int)DiscoveryFormStatus.ServiceSent
                            };
                        }
                        else
                        {
                            form.Status = new OptionSetValueWrapper()
                            {
                                AttributeValue = (int)DiscoveryFormStatus.ServiceError
                            };

                            FileLogHelper.LogFunction(this.GetType().Name, "SendToService::" + result.Result, @Globals.FileLogPath);
                        }

                        DiscoveryFormHelper.UpdateDiscoveryForm(form, _service);
                    }
                }
                catch (Exception ex)
                {
                    FileLogHelper.LogFunction(this.GetType().Name, ex.Message, @Globals.FileLogPath);
                }
            }
            else
            {
                FileLogHelper.LogFunction(this.GetType().Name, resultRequestList.Result, @Globals.FileLogPath);
            }
        }