Пример #1
0
 public int Save(SETUP_MaritalStatus newSetupMaritalStatus)
 {
     try
     {
         SCMSDataContext dbSCMS = Connection.Create();
         SETUP_MaritalStatus existingMaritalStatus = dbSCMS.SETUP_MaritalStatus.Where(c => c.MS_Id.Equals(newSetupMaritalStatus.MS_Id)).SingleOrDefault();
         if (existingMaritalStatus != null)
         {
             existingMaritalStatus.MS_Title = newSetupMaritalStatus.MS_Title;
             existingMaritalStatus.MS_Abbreviation = newSetupMaritalStatus.MS_Abbreviation;
             existingMaritalStatus.MS_Active = newSetupMaritalStatus.MS_Active;
             existingMaritalStatus.MS_SortOrder = newSetupMaritalStatus.MS_SortOrder;
         }
         else
         {
             dbSCMS.SETUP_MaritalStatus.InsertOnSubmit(newSetupMaritalStatus);
         }
         dbSCMS.SubmitChanges();
         return Convert.ToInt32(newSetupMaritalStatus.MS_Id);
     }
     catch
     {
         return 0;
     }
 }
Пример #2
0
        public ActionResult SaveRecord(string Code, string Title, string Abbreviation)
        {
            Int32 li_ReturnValue = 0;

            try
            {
                SETUP_MaritalStatus row_MaritalStatus = new SETUP_MaritalStatus();

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

                if (!String.IsNullOrEmpty(Code))
                {
                    row_MaritalStatus.MS_Id = Code;
                    row_MaritalStatus.MS_Code = Code;
                    row_MaritalStatus.MS_Title = Title;
                    row_MaritalStatus.MS_Abbreviation = Abbreviation;
                    row_MaritalStatus.MS_Active = 1;
                    row_MaritalStatus.MS_SortOrder = 1;

                    li_ReturnValue = objDalMaritalStatus.Save(row_MaritalStatus);
                    ViewData["SaveResult"] = li_ReturnValue;
                }

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