Beispiel #1
0
 public ENResult delete(uspSASaleSearch_Result data)
 {
     try
     {
         using (erpStoreEntities db = new erpStoreEntities())
         {
             db.uspSASaleDelete(data.idSale, PUser, PReturnCode, PReturnMessage);
             return(new ENResult(Convert.ToInt32(PReturnCode.Value), Convert.ToString(PReturnMessage.Value)));
         }
     }
     catch (Exception ex)
     {
         return(PUnexpectedError(ex));
     }
 }
Beispiel #2
0
 public ENResult insert(uspSASaleSearch_Result data, List <uspSASaleDetailSearch_Result> detail)
 {
     try
     {
         using (erpStoreEntities db = new erpStoreEntities())
         {
             ObjectParameter objIdSale = new ObjectParameter("idSale", 0);
             db.uspSASaleInsert(data.documentType, data.documentNumber, data.date, data.ticket,
                                data.status, PUser, objIdSale, PReturnCode, PReturnMessage);
             if (Convert.ToInt32(PReturnCode.Value) == 0)
             {
                 int    codeTemp    = 0;
                 string messageTemp = "";
                 for (int i = 0; i < detail.Count; i++)
                 {
                     db.uspSASaleDetailInsert(Convert.ToInt32(objIdSale), detail[i].idProduct, detail[i].quantity, detail[i].unitPrice, detail[i].partSale, PUser, PReturnCode, PReturnMessage);
                     codeTemp    = Convert.ToInt32(PReturnCode.Value);
                     messageTemp = Convert.ToString(PReturnMessage.Value);
                     if (codeTemp != 0)
                     {
                         break;
                     }
                 }
                 return(new ENResult(codeTemp, messageTemp));
             }
             else
             {
                 return(new ENResult(Convert.ToInt32(PReturnCode.Value), Convert.ToString(PReturnMessage.Value)));
             }
         }
     }
     catch (Exception ex)
     {
         return(PUnexpectedError(ex));
     }
 }