public HttpResponseMessage Save(TransferOut to)
 {
     if (to.ID > 0)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, to.Update()));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.OK, to.Save()));
     }
 }
Example #2
0
        private void SaveRecord()
        {
            TransferOutDetails clsDetails = new TransferOutDetails();

            clsDetails.TransferOutID       = Convert.ToInt64(lblTransferOutID.Text);
            clsDetails.TransferOutNo       = lblTransferOutNo.Text;
            clsDetails.TransferOutDate     = Convert.ToDateTime(lblTransferOutDate.Text);
            clsDetails.SupplierID          = Convert.ToInt64(cboSupplier.SelectedItem.Value);
            clsDetails.SupplierCode        = cboSupplier.SelectedItem.Text;
            clsDetails.SupplierContact     = txtSupplierContact.Text;
            clsDetails.SupplierAddress     = txtSupplierAddress.Text;
            clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text;
            switch (lblModeOfterms.Text)
            {
            case "Days":
                clsDetails.SupplierModeOfTerms = 0;
                break;

            case "Months":
                clsDetails.SupplierModeOfTerms = 1;
                break;

            case "Years":
                clsDetails.SupplierModeOfTerms = 2;
                break;
            }
            clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text);
            clsDetails.BranchID             = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.TransferrerID        = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.TransferrerName      = Session["Name"].ToString();
            clsDetails.Status  = TransferOutStatus.Open;
            clsDetails.Remarks = txtRemarks.Text;

            TransferOut clsTransferOut = new TransferOut();

            clsTransferOut.Update(clsDetails);
            clsTransferOut.CommitAndDispose();
        }