//UpdateConsignmentContract
    public ConsignmentContract UpdateConsignmentContract(ConsignmentContract cc)
    {
      ConsignmentContract consignmentContract = dataContext.ConsignmentContracts.FirstOrDefault(t => t.ConsignmentID == cc.ConsignmentID);
      if (consignmentContract == null)
      {
        consignmentContract = new ConsignmentContract { ConsignmentID = cc.ConsignmentID };
        dataContext.ConsignmentContracts.InsertOnSubmit(consignmentContract);
      }
      consignmentContract.UpdateFields(cc);
      SubmitChanges();
      return consignmentContract;

    }
Ejemplo n.º 2
0
        //UpdateConsignmentContract
        public ConsignmentContract UpdateConsignmentContract(ConsignmentContract cc)
        {
            ConsignmentContract consignmentContract = dataContext.ConsignmentContracts.FirstOrDefault(t => t.ConsignmentID == cc.ConsignmentID);

            if (consignmentContract == null)
            {
                consignmentContract = new ConsignmentContract {
                    ConsignmentID = cc.ConsignmentID
                };
                dataContext.ConsignmentContracts.InsertOnSubmit(consignmentContract);
            }
            consignmentContract.UpdateFields(cc);
            SubmitChanges();
            return(consignmentContract);
        }
 public void UpdateFields(ConsignmentContract cc)
 {
     UpdateFields(cc.ConsignmentID, cc.StatusID, cc.ContractText, cc.FileName);
 }
 public void UpdateFields(ConsignmentContract cc)
 {
   UpdateFields(cc.ConsignmentID, cc.StatusID, cc.ContractText, cc.FileName);
 }
 //GetConsingorStatementDataJSON
 public object GetConsingorStatementDataJSON(long consignmentID)
 {
     Consignment consignment = GetConsignment(consignmentID);
     if (consignment == null) return null;
     ConsignmentContract consignmentContract = GetConsignmentContract(consignmentID);
     if (consignmentContract == null)
     {
         string filePath = DiffMethods.TemplateDifferentOnDisk("ConsignmentContract.txt");
         FileInfo fileInfo = new FileInfo(filePath);
         string contractTemplate = string.Empty;
         if (fileInfo.Exists)
         {
             contractTemplate = File.ReadAllText(filePath);
             decimal buyerFee = consignment.Event.BuyerFee.GetValueOrDefault(0).GetPrice();
             string buyerFeeStr = buyerFee.ToString();
             if (buyerFee == (int)buyerFee)
             {
                 buyerFeeStr = buyerFeeStr.Remove(buyerFeeStr.Length - 3);
             }
             contractTemplate = contractTemplate.Replace("{{BuyersPremium}}", string.Format("{0}%", buyerFeeStr)).Replace("{{CommissionRate}}", consignment.User.CommissionRate.LongDescription);
         }
         consignmentContract = new ConsignmentContract();
         consignmentContract.UpdateFields(consignment.ID, (int)Consts.ConsignmentContractStatus.NotGenerated, contractTemplate, string.Empty);
         consignmentContract = UpdateConsignmentContract(consignmentContract);
     }
     var jsonData = new
     {
         id = consignment.ID,
         e = consignment.Event_ID,
         s = consignment.Specialist_ID,
         u = consignment.User_ID,
         u_t = consignment.User.Login + " (" + consignment.User.AddressCard_Billing.FirstName + " " + consignment.User.AddressCard_Billing.LastName + ")",
         c = consignment.User.CommissionRate_ID,
         cd = consignment.ConsDate.ToString("MM/dd/yyyy hh:mm tt"),
         ccs = consignmentContract.StatusID,
         ccst = ((Consts.ConsignmentContractStatus)consignmentContract.StatusID).ToString(),
         cct = consignmentContract.ContractText
     };
     return jsonData;
 }