Analyzing Data

Author: Old Cen

Many a time we judge the data when it is needed a lot of conditions.
For example, we go to modify a data, must have at least three judges, modify, tweak the failure, the data is incomplete, the three little judgment. The amount of code needed to be a lot.
We are in the process of judgment, but also a lot of disappointments, such as different types of judgment.
For example, like this:

That encounter this situation how can we do?
I was depressed for a long time, but I gave it to fiddle with it, and that is a plus .ToSting ()
public ActionResult AmendBorrowMoney (S_User ModUser, B__BorrowMoney modBorrowMoney, B__KindType modKindtype, B___PaymentMethod modPaymentMethod)
{
ReturnJson msg = new new ReturnJson ();
if (!string.IsNullOrEmpty(modBorrowMoney.Borrowing) && !string.IsNullOrEmpty(modUser.UserName) && !string.IsNullOrEmpty(modBorrowMoney.BorrowingTitle) && !string.IsNullOrEmpty(modBorrowMoney.BorrowingBalance.ToString()) && !string.IsNullOrEmpty(modBorrowMoney.RateInterest.ToString()) && !string.IsNullOrEmpty(modBorrowMoney.LifeLoan.ToString()) && !string.IsNullOrEmpty(modKindtype.KindName) && !string.IsNullOrEmpty(modPaymentMethod.PaymentMethodName) && !string.IsNullOrEmpty(modBorrowMoney.SubmissionTime.ToString()) && !string.IsNullOrEmpty(modBorrowMoney.AuditStatus))
{
myModels.B__BorrowMoney.Add(modBorrowMoney);
myModels.S_User.Add(modUser);
myModels.B__KindType.Add(modKindtype);
myModels.B___PaymentMethod.Add(modPaymentMethod);
IF (myModels.SaveChanges ()> 0)
{
msg.State = to true;
msg.Text = "modified successfully!";
}
the else
{
msg.Text = "modification failed!";
}
}
the else
{
msg.Text = "Data incomplete ";!
}
return Json (msg, JsonRequestBehavior.AllowGet);
}
of course, this is only the inside of the controller to determine if the data deceives want to have to go out of view in the data backfill and so on, but also a lot of judgment, but as long as it comes out this logic controllers also put the modifications completed seventy to eighty percent of the.
Backfill step this way probably
function saveDelete {(borrowmoneyID)
blInsert = to false; // modify operations
$ ( "# formBorrowMoney input [type = 'reset']") click ();. // reset the form
$ ( "# . modalBorrowMoney ") modal (); // modal popup window
@ modal form data backfill
$ .getJSON ( "/ QJtabulation / BorrowMoney / Index / SelectBorrowMoneyID? BorrowMoneyID =" + borrowmoneyID, function (data)
like this a simple modification to get out.
seems simple, but I think that is not simple.

Guess you like

Origin blog.csdn.net/weixin_44541224/article/details/90580310