Пример #1
0
        public int SaveRecord(SETUP_LeaveType lrow_LeaveType)
        {
            int li_ReturnValue = 0;

            try
            {
                SCMSDataContext dbSCMS = Connection.Create();
                SETUP_LeaveType lRow_ExistingData = dbSCMS.SETUP_LeaveTypes.Where(c => c.LevTyp_Id.Equals(lrow_LeaveType.LevTyp_Id)).SingleOrDefault();

                if (lRow_ExistingData != null)
                {
                    lRow_ExistingData.LevTyp_Title = lrow_LeaveType.LevTyp_Title;
                    lRow_ExistingData.Loc_Id = lrow_LeaveType.Loc_Id;
                    lRow_ExistingData.LevTyp_Count = lrow_LeaveType.LevTyp_Count;
                    lRow_ExistingData.LevTyp_Abbreviation = lrow_LeaveType.LevTyp_Abbreviation;
                }
                else
                {
                    dbSCMS.SETUP_LeaveTypes.InsertOnSubmit(lrow_LeaveType);
                }
                dbSCMS.SubmitChanges();

                li_ReturnValue = Convert.ToInt32(lrow_LeaveType.LevTyp_Id);
            }
            catch
            {
                return 0;
            }

            return li_ReturnValue;
        }
Пример #2
0
        public ActionResult SaveRecord(string Code, string Location, string Title, string Abbreviation, string Count)
        {
            Int32 li_ReturnValue = 0;

            try
            {
                SETUP_LeaveType row_LeaveType = new SETUP_LeaveType();

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

                if (!String.IsNullOrEmpty(Code))
                {
                    row_LeaveType.LevTyp_Id = Code;
                    row_LeaveType.LevTyp_Code = Code;
                    row_LeaveType.LevTyp_Title = Title;
                    row_LeaveType.LevTyp_Active = 1;
                    row_LeaveType.LevTyp_SortOrder = 1;
                    row_LeaveType.LevTyp_Count = Count;
                    row_LeaveType.LevTyp_Abbreviation = Abbreviation;
                    row_LeaveType.Loc_Id = Location;

                    li_ReturnValue = objDALLeaveType.SaveRecord(row_LeaveType);
                    ViewData["SaveResult"] = li_ReturnValue;
                }

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