Exemplo n.º 1
0
 public int Save(SETUP_Religion newSetupReligion)
 {
     try
     {
         SCMSDataContext dbSCMS = Connection.Create();
         SETUP_Religion existingGender = dbSCMS.SETUP_Religions.Where(c => c.Rlgn_Id.Equals(newSetupReligion.Rlgn_Id)).SingleOrDefault();
         if (existingGender != null)
         {
             existingGender.Rlgn_Title = newSetupReligion.Rlgn_Title;
             existingGender.Rlgn_Abbreviation = newSetupReligion.Rlgn_Abbreviation;
             existingGender.Rlgn_Active = newSetupReligion.Rlgn_Active;
             existingGender.Rlgn_SortOrder = newSetupReligion.Rlgn_SortOrder;
         }
         else
         {
             dbSCMS.SETUP_Religions.InsertOnSubmit(newSetupReligion);
         }
         dbSCMS.SubmitChanges();
         return Convert.ToInt32(newSetupReligion.Rlgn_Id);
     }
     catch
     {
         return 0;
     }
 }
Exemplo n.º 2
0
        public ActionResult SaveRecord(string Code, string Title, string Abbreviation)
        {
            Int32 li_ReturnValue = 0;

            try
            {
                SETUP_Religion row_Religion = new SETUP_Religion();

                if (String.IsNullOrEmpty(Code))
                {
                    if (DALCommon.AutoCodeGeneration("SETUP_Religion") == 1)
                    {
                        Code = DALCommon.GetMaximumCode("SETUP_Religion");
                    }
                }

                if (!String.IsNullOrEmpty(Code))
                {
                    row_Religion.Rlgn_Id = Code;
                    row_Religion.Rlgn_Code = Code;
                    row_Religion.Rlgn_Title = Title;
                    row_Religion.Rlgn_Abbreviation = Abbreviation;
                    row_Religion.Rlgn_Active = 1;
                    row_Religion.Rlgn_SortOrder = 1;

                    li_ReturnValue = objDalReligion.Save(row_Religion);
                    ViewData["SaveResult"] = li_ReturnValue;
                }

                return PartialView("GridData");
            }
            catch
            {
                return PartialView("GridData");
            }
        }