Esempio n. 1
0
        public List <int> getExitsQuoteProposal(QuoteCreateRequest obj, string _userI)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <int> ListQuote = QuoteDataLayer.GetInstance().getExitsQuoteProposal(connection, obj.ProposalList, obj.CustomerList, _userI);
                return(ListQuote);
            }
        }
Esempio n. 2
0
        public ActionMessage CreateQuote([FromBody] QuoteCreateRequest QuoteObj)
        {
            ActionMessage ret = new ActionMessage();

            try
            {
                ret = QuoteService.GetInstance().CreateQuoteWithMutilProposal(QuoteObj, this.GetUserId());
            }
            catch (Exception ex)
            {
                ret.isSuccess     = false;
                ret.err.msgCode   = "Internal Error !!!";
                ret.err.msgString = ex.ToString();
            }
            return(ret);
        }
Esempio n. 3
0
        public ActionMessage CreateQuoteWithMutilProposal(QuoteCreateRequest QuoteObj, string _userI)
        {
            ActionMessage        ret           = new ActionMessage();
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                try
                {
                    int quoteId = 0;

                    quoteId = QuoteDataLayer.GetInstance().InsertQuoteWithOutDetails(connection, _userI);
                    int i = 0;
                    foreach (int customerID in QuoteObj.CustomerList)
                    {
                        if (QuoteObj.CustomerList.Length == 1)
                        {
                            QuoteDataLayer.GetInstance().InsertQuoteCustomer(connection, quoteId, customerID, true);
                        }
                        else
                        {
                            if (i == 0)
                            {
                                QuoteDataLayer.GetInstance().InsertQuoteCustomer(connection, quoteId, customerID, true);
                            }
                            else
                            {
                                QuoteDataLayer.GetInstance().InsertQuoteCustomer(connection, quoteId, customerID, false);
                            }
                        }
                        i++;
                    }
                    foreach (int proposalId in QuoteObj.ProposalList)
                    {
                        QuoteDataLayer.GetInstance().InsertQuoteProposal(connection, quoteId, proposalId);
                    }
                    ret.isSuccess = true;
                }
                catch (Exception ex)
                {
                    ret.isSuccess     = false;
                    ret.err.msgCode   = "Internal Error";
                    ret.err.msgString = ex.Message;
                }
            }
            return(ret);
        }
Esempio n. 4
0
        public ListResponeMessage <int> getExitsQuote([FromBody] QuoteCreateRequest QuoteObj)
        {
            ListResponeMessage <int> ret = new ListResponeMessage <int>();

            try
            {
                ret.data      = QuoteService.GetInstance().getExitsQuoteProposal(QuoteObj, this.GetUserId());
                ret.isSuccess = true;
            }
            catch (Exception ex)
            {
                ret.isSuccess     = false;
                ret.err.msgCode   = "Internal Error !!!";
                ret.err.msgString = ex.ToString();
            }
            return(ret);
        }