public ActionResult PeriodicPayment2(PeriodicPaymentModel model) { bool TheError = false; if (ModelState.IsValid) { Connection.Connection con = new Connection.Connection(); if (User.Identity.GetUserId() == null) { TheError = con.AddUserAndDonator(model); } else { TheError = con.UpdateUserAndDonator(model, User.Identity.GetUserId()); } } if (TheError == false) { return(RedirectToAction("Index", "Manage", new { Message = Models.ManageMessageId.PeriodicPaymentFormSuccess })); } else { return(View(model)); } }
public ActionResult PeriodicPayment2() { PeriodicPaymentModel lmd = new PeriodicPaymentModel(); Connection.Connection con = new Connection.Connection(); DateTimeFormatInfo format = new DateTimeFormatInfo(); format.ShortDatePattern = "mm/dd/yyyy"; if (User.Identity.GetUserId() != null) { DataSet ds = new DataSet(); ds = con.DonatorData(User.Identity.GetUserId()); if (ds.Tables[0].Rows.Count == 1) { DataRow dr = ds.Tables[0].Rows[0]; lmd.Us_Name = dr["Us_Name"].ToString(); lmd.Us_LName = dr["Us_LName"].ToString(); lmd.Us_Phone = dr["Us_Phone"].ToString(); lmd.Us_Email = dr["Us_Email"].ToString(); lmd.Us_BirthDay = Convert.ToDateTime(dr["Us_BirthDay"], format); lmd.Us_HomeAddress = dr["Us_HomeAddress"].ToString(); lmd.Us_WorkAddress = dr["Us_WorkAddress"].ToString(); lmd.City_Ct_Id = Convert.ToInt16(dr["City_Ct_Id"]); lmd.SelectedState = con.StateData(lmd.City_Ct_Id); lmd.SelectedCountry = con.CountryData(lmd.SelectedState); lmd.Countries = con.GetListOfCountries(); lmd.States = con.GetListOfStates(lmd.SelectedCountry); lmd.Cities = con.GetListOfCities(lmd.SelectedState); if (dr["Dr_Us_ID"].ToString() != "") { lmd.Dr_AccTransaction = Convert.ToBoolean(dr["Dr_AccTransaction"]); lmd.Dr_Amount = Convert.ToInt32(dr["Dr_Amount"]); lmd.Dr_CardTranscation = Convert.ToBoolean(dr["Dr_CardTranscation"]); lmd.Dr_Cleaner = Convert.ToBoolean(dr["Dr_Cleaner"]); lmd.Dr_Clothes = Convert.ToBoolean(dr["Dr_Clothes"]); lmd.Dr_CT_Code = Convert.ToByte(dr["Dr_CT_Code"]); lmd.Dr_Endowment = Convert.ToBoolean(dr["Dr_Endowment"]); lmd.Dr_Food = Convert.ToBoolean(dr["Dr_Food"]); lmd.Dr_HelpDay = Convert.ToByte(dr["Dr_HelpDay"]); lmd.Dr_Inperson = Convert.ToBoolean(dr["Dr_Inperson"]); lmd.Dr_Medical = Convert.ToBoolean(dr["Dr_Medical"]); lmd.Dr_Month_Duration = Convert.ToByte(dr["Dr_Month_Duration"]); lmd.Dr_Representative = Convert.ToBoolean(dr["Dr_Representative"]); lmd.Dr_Stationery = Convert.ToBoolean(dr["Dr_Stationery"]); } return(View(lmd)); } } lmd.Us_BirthDay = Convert.ToDateTime(DateTime.Now, format); lmd.Countries = con.GetListOfCountries(); lmd.States = con.GetListOfStates(1); lmd.Cities = con.GetListOfCities(1); //lmd.City_Ct_Id-=Convert.ToInt16(lmd.Cities[0].value; return(View(lmd)); }