Esempio n. 1
0
    public static String SaveDecision(int quotationID, int decision)
    {
        OMMDataContext dataContext = new OMMDataContext();
        var            quotation   = dataContext.Quotations.SingleOrDefault(Q => Q.ID == quotationID);

        if (quotation != null)
        {
            quotation.StatusID = decision;
            ///If Requote is Requested for this quotation
            if (decision == App.CustomModels.QuotationStatus.ReQquoteRequested)
            {
                quotation.Number   = dataContext.GenerateNewQuotationNumber(quotation.EnquiryID, true);
                quotation.StatusID = App.CustomModels.QuotationStatus.NotSubmitted;
            }

            quotation.ChangedByUserID   = SessionCache.CurrentUser.ID;
            quotation.ChangedByUsername = SessionCache.CurrentUser.UserName; //SessionCache.CurrentUser.UserNameWeb;
            quotation.ChangedOn         = DateTime.Now;
            //if (decision == App.CustomModels.QuotationStatus.Successful || decision == App.CustomModels.QuotationStatus.Unsuccessful)
            //    quotation.Enquiry.StatusID = App.CustomModels.EnquiryStatus.Closed;
            //else if (decision == App.CustomModels.QuotationStatus.ReQquoteRequested)
            //{
            //    //Create a New Quotation for this Enquiry with this objects data

            //}
            //if (decision == App.CustomModels.QuotationStatus.Successful)
            //    quotation.Projects.Add(CreateProjectFromQuotation(quotation, dataContext));

            dataContext.SubmitChanges();
            return(String.Format("{0}:{1}", quotation.ID, quotation.Number));
        }
        return(String.Empty);
    }
Esempio n. 2
0
    public String SubmitQuotation(int id, int clientContactId)
    {
        OMMDataContext dataContext = new OMMDataContext();
        var            quotation   = dataContext.Quotations.SingleOrDefault(Q => Q.ID == id);

        if (quotation != null)
        {
            quotation.StatusID = App.CustomModels.QuotationStatus.Submitted;
            quotation.Number   = dataContext.GenerateNewQuotationNumber(quotation.EnquiryID, true);
            dataContext.SubmitChanges();
            return(quotation.Number);
        }
        return(String.Empty);
    }
Esempio n. 3
0
    private static void MapObject(Quotation quotation, App.CustomModels.CustomQuotation customQuotation, OMMDataContext dataContext)
    {
        if (customQuotation.ID == 0)
        {
            quotation.CreatedByUserID   = SessionCache.CurrentUser.ID;
            quotation.CreatedByUsername = SessionCache.CurrentUser.UserName;
            quotation.CreatedOn         = DateTime.Now;
            quotation.Number            = dataContext.GenerateNewQuotationNumber(quotation.EnquiryID, false);
            quotation.StatusID          = App.CustomModels.QuotationStatus.NotSubmitted;
        }
        quotation.ChangedByUserID   = SessionCache.CurrentUser.ID;
        quotation.ChangedByUsername = SessionCache.CurrentUser.UserName;
        quotation.ChangedOn         = DateTime.Now;

        quotation.EnquiryID      = customQuotation.EnquiryID;
        quotation.Subcontractor  = customQuotation.Subcontractor;
        quotation.ScopeOfWork    = customQuotation.ScopeOfWork;
        quotation.MainEquipment  = customQuotation.MainEquipment;
        quotation.Schedule       = customQuotation.Scheduel;
        quotation.ValidityDays   = customQuotation.ValidityDays;
        quotation.SubmissionDate = WebUtil.GetDate(customQuotation.SubmissionDate);
        if (customQuotation.DecisionDate.IsNullOrEmpty())
        {
            quotation.DecisionDate = null;
        }
        else
        {
            quotation.DecisionDate = WebUtil.GetDate(customQuotation.DecisionDate);
        }

        quotation.CurrencyID  = customQuotation.CurrencyID;
        quotation.ProjectYear = customQuotation.ProjectYear;


        //var currency = dataContext.Currencies.SingleOrDefault(C => C.Description == ddlCurrency.SelectedValue);
        //if(currency != null)
        //    quotation.CurrencyID = currency.ID;
    }