public int Add([FromBody] Guarantees obj)
 {
     try
     {
         string sql = "INSERT INTO Guarantees(DateCreated,EmployeeID,CustomerID,CastumerName,GuaranteeNumber,BeneficiaryID,StartDate,expirationDate,GuaranteeType,Essence,About,Amount,EstimatedAmount," +
                      "Commission,CommissionPercent,DocumentsCommission,DocumentsCommissionPercent,IndexType,IndexDate,Currency,CurrencyValue,Status,Note,SentTObusinessManager," +
                      "SentTOcustomer,SentToManagerSignature,Starttreatment,Endoftreatment,Extension)OUTPUT INSERTED.GuaranteeID VALUES(@DateCreated,@EmployeeID,@CustomerID,@CastumerName,@GuaranteeNumber,@BeneficiaryID,@StartDate,@expirationDate,@GuaranteeType,@Essence,@About,@Amount,@EstimatedAmount," +
                      "@Commission,@CommissionPercent,@DocumentsCommission,@DocumentsCommissionPercent,@IndexType,@IndexDate,@Currency,@CurrencyValue,@Status,@Note,@SentTObusinessManager," +
                      "@SentTOcustomer,@SentToManagerSignature,@Starttreatment,@Endoftreatment,@Extension)";
         return(DB.ExecuteCommand(sql, (cmd) => {
             cmd.Parameters.AddWithValueCheckNull("@DateCreated", obj.DateCreated);
             cmd.Parameters.AddWithValueCheckNull("@EmployeeID", obj.EmployeeID);
             cmd.Parameters.AddWithValueCheckNull("@CustomerID", obj.CustomerID);
             cmd.Parameters.AddWithValueCheckNull("@CastumerName", obj.CastumerName);
             cmd.Parameters.AddWithValueCheckNull("@GuaranteeNumber", obj.GuaranteeNumber);
             cmd.Parameters.AddWithValueCheckNull("@BeneficiaryID", obj.BeneficiaryID);
             cmd.Parameters.AddWithValueCheckNull("@StartDate", obj.StartDate);
             cmd.Parameters.AddWithValueCheckNull("@expirationDate", obj.ExpirationDate);
             cmd.Parameters.AddWithValueCheckNull("@GuaranteeType", obj.GuaranteeType);
             cmd.Parameters.AddWithValueCheckNull("@Essence", obj.Essence);
             cmd.Parameters.AddWithValueCheckNull("@About", obj.About);
             cmd.Parameters.AddWithValueCheckNull("@Amount", obj.@Amount);
             cmd.Parameters.AddWithValueCheckNull("@EstimatedAmount", obj.EstimatedAmount);
             cmd.Parameters.AddWithValueCheckNull("@Commission", obj.Commission);
             cmd.Parameters.AddWithValueCheckNull("@CommissionPercent", obj.CommissionPercent);
             cmd.Parameters.AddWithValueCheckNull("@DocumentsCommission", obj.DocumentsCommission);
             cmd.Parameters.AddWithValueCheckNull("@DocumentsCommissionPercent", obj.DocumentsCommissionPercent);
             cmd.Parameters.AddWithValueCheckNull("@IndexType", obj.IndexType);
             cmd.Parameters.AddWithValueCheckNull("@IndexDate", obj.IndexDate);
             cmd.Parameters.AddWithValueCheckNull("@Currency", obj.Currency);
             cmd.Parameters.AddWithValueCheckNull("@CurrencyValue", obj.CurrencyValue);
             cmd.Parameters.AddWithValueCheckNull("@Status", obj.Status);
             cmd.Parameters.AddWithValueCheckNull("@Note", obj.Note);
             cmd.Parameters.AddWithValueCheckNull("@SentTObusinessManager", obj.SentTObusinessManager);
             cmd.Parameters.AddWithValueCheckNull("@SentTOcustomer", obj.SentTOcustomer);
             cmd.Parameters.AddWithValueCheckNull("@SentToManagerSignature", obj.SentToManagerSignature);
             cmd.Parameters.AddWithValueCheckNull("@Starttreatment", obj.Starttreatment);
             cmd.Parameters.AddWithValueCheckNull("@Endoftreatment", obj.Endoftreatment);
             cmd.Parameters.AddWithValueCheckNull("@Extension", obj.Extension);
         }, true));
     }
     catch (Exception)
     {
         return(-1);
     }
 }
Пример #2
0
        public Tempdata Add([FromBody] Tempdata obj)
        {
            try
            {
                int         id;
                Tempdata    tempdata;
                Guarantees  guarantees;
                Customer    customer;
                Employees   employees;
                Beneficiary beneficiary;
                Groups      groups;



                id = Tempdata.Binary(tempdatas, obj.Guarantee.GuaranteeID, 0, tempdatas.Count - 1);
                if (id >= 0)
                {
                    if (tempdatas[id].Guarantee.GuaranteeID == obj.Guarantee.GuaranteeID)
                    {
                        return(tempdatas[id]);
                    }
                }


                tempdata = new Tempdata(guarantees = new Guarantees(obj.Guarantee.GuaranteeID, obj.Guarantee.DateCreated, obj.Guarantee.EmployeeID, obj.Guarantee.CustomerID, obj.Guarantee.CastumerName, obj.Guarantee.GuaranteeNumber, obj.Guarantee.BeneficiaryID, obj.Guarantee.StartDate, obj.Guarantee.ExpirationDate, obj.Guarantee.GuaranteeType, obj.Guarantee.Essence,
                                                                    obj.Guarantee.About, obj.Guarantee.Amount, obj.Guarantee.EstimatedAmount, obj.Guarantee.Commission, obj.Guarantee.CommissionPercent, obj.Guarantee.DocumentsCommission, obj.Guarantee.DocumentsCommissionPercent, obj.Guarantee.IndexType, obj.Guarantee.IndexDate,
                                                                    obj.Guarantee.Currency, obj.Guarantee.CurrencyValue, obj.Guarantee.Status, obj.Guarantee.Note, obj.Guarantee.SentTObusinessManager, obj.Guarantee.SentTOcustomer, obj.Guarantee.SentToManagerSignature, obj.Guarantee.Starttreatment, obj.Guarantee.Endoftreatment, obj.Guarantee.Extension),
                                        customer    = new Customer(obj.Customer.CustomerID, obj.Customer.AcountNumber, obj.Customer.CompantName, obj.Customer.Contactman, obj.Customer.CompanyMail, obj.Customer.CompanyAddress, obj.Customer.CompanyPhone, obj.Customer.CompanyFax, obj.Customer.GroupID, obj.Customer.Guaranteecounter, obj.Customer.ExecutionCommission, obj.Customer.FormalCommission, obj.Customer.CreditsecurityCommission, obj.Customer.DocumentsCommission),
                                        employees   = new Employees(obj.Employees.EmployeeID, obj.Employees.EmployeNumber, obj.Employees.Username, obj.Employees.EmployeMail, obj.Employees.EmployePhone, obj.Employees.Permission, obj.Employees.Titel, obj.Employees.GroupID),
                                        beneficiary = new Beneficiary(obj.Beneficiary.beneficiaryID, obj.Beneficiary.beneficiaryName, obj.Beneficiary.beneficiaryMail, obj.Beneficiary.beneficiaryPhone, obj.Beneficiary.beneficiaryFax, obj.Beneficiary.beneficiaryAddress),
                                        groups      = new Groups(obj.group.GroupID, obj.group.GroupName, obj.group.GroupMail, obj.group.GroupPhone, obj.group.GroupFax));


                tempdatas.Add(tempdata);
                Tempdata.Bubbl(tempdatas);
                return(tempdata);
            }
            catch (Exception)
            {
                return(null);
            }
        }