Exemple #1
0
        public Hr_EmpPermission_Settings GetPermmissionSettingDataByBranchandCompany(string strCompany_Id, string strBranch_Id)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();


            try
            {
                OpenEntityConnection();

                Hr_EmpPermission_Settings ObjEmpPermission_Settings = (from objLinq in objPharmaEntities.Hr_EmpPermission_Settings
                                                                       where objLinq.Company_Id == strCompany_Id && objLinq.Branch_Id == strBranch_Id
                                                                       select objLinq).FirstOrDefault();

                if (ObjEmpPermission_Settings != null)
                {
                    Hr_EmpPermission_Settings objEmpPermission_SettingsDL = new Hr_EmpPermission_Settings();

                    {
                        objEmpPermission_SettingsDL.Branch_Id  = ObjEmpPermission_Settings.Branch_Id;
                        objEmpPermission_SettingsDL.Company_Id = ObjEmpPermission_Settings.Company_Id;
                        objEmpPermission_SettingsDL.AllowedValueInMonthByHour = ObjEmpPermission_Settings.AllowedValueInMonthByHour;
                        objEmpPermission_SettingsDL.AllowedValueInDayByHour   = ObjEmpPermission_Settings.AllowedValueInDayByHour;
                        objEmpPermission_SettingsDL.PeriodForDay                     = ObjEmpPermission_Settings.PeriodForDay;
                        objEmpPermission_SettingsDL.HourNoForDiscount                = ObjEmpPermission_Settings.HourNoForDiscount;
                        objEmpPermission_SettingsDL.AllowToExceedMonthValue          = ObjEmpPermission_Settings.AllowToExceedMonthValue;
                        objEmpPermission_SettingsDL.AllowToExceedDayValue            = ObjEmpPermission_Settings.AllowToExceedDayValue;
                        objEmpPermission_SettingsDL.OnlyApplyDiscount                = ObjEmpPermission_Settings.OnlyApplyDiscount;
                        objEmpPermission_SettingsDL.CountOfPermissionAllowedInMonth  = ObjEmpPermission_Settings.CountOfPermissionAllowedInMonth;
                        objEmpPermission_SettingsDL.AllowToExceedCountAllowedInMonth = ObjEmpPermission_Settings.AllowToExceedCountAllowedInMonth;
                        objEmpPermission_SettingsDL.AllowedMenthodType               = ObjEmpPermission_Settings.AllowedMenthodType;
                    }
                    return(objEmpPermission_SettingsDL);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(),
                                      this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString());
                ex.InnerException.Message.ToString();
                return(null);
            }
            finally
            {
                CloseEntityConnection();
            }
        }
Exemple #2
0
        public bool SavePermmissionSettingData(Hr_EmpPermission_Settings objList)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();


            try
            {
                OpenEntityConnection();


                int Result = 0;
                //   string emSerialNo = (objList.EmpSerialForDocNotify == null ? 0 : objList.EmpSerialForDocNotify).ToString();



                Hr_EmpPermission_Settings ObjForUpdate = (from objLinq in objPharmaEntities.Hr_EmpPermission_Settings
                                                          where objLinq.Company_Id == objList.Company_Id && objLinq.Branch_Id == objList.Branch_Id
                                                          select objLinq).FirstOrDefault();
                if (ObjForUpdate != null)
                {
                    ObjForUpdate.AllowedValueInMonthByHour = objList.AllowedValueInMonthByHour;
                    ObjForUpdate.AllowedValueInDayByHour   = objList.AllowedValueInDayByHour;
                    ObjForUpdate.PeriodForDay      = objList.PeriodForDay;
                    ObjForUpdate.HourNoForDiscount = objList.HourNoForDiscount;

                    ObjForUpdate.AllowToExceedMonthValue = objList.AllowToExceedMonthValue;
                    ObjForUpdate.AllowToExceedDayValue   = objList.AllowToExceedDayValue;
                    ObjForUpdate.OnlyApplyDiscount       = objList.OnlyApplyDiscount;

                    ObjForUpdate.CountOfPermissionAllowedInMonth  = objList.CountOfPermissionAllowedInMonth;
                    ObjForUpdate.AllowToExceedCountAllowedInMonth = objList.AllowToExceedCountAllowedInMonth;
                    ObjForUpdate.AllowedMenthodType = objList.AllowedMenthodType;


                    Result = objPharmaEntities.SaveChanges();

                    return(Result > 0);
                }
                else
                {
                    if (objList != null)
                    {
                        Hr_EmpPermission_Settings loclDtls = new Hr_EmpPermission_Settings
                        {
                            Branch_Id  = objList.Branch_Id,
                            Company_Id = objList.Company_Id,
                            AllowedValueInMonthByHour = objList.AllowedValueInMonthByHour,
                            AllowedValueInDayByHour   = objList.AllowedValueInDayByHour,
                            PeriodForDay            = objList.PeriodForDay,
                            HourNoForDiscount       = objList.HourNoForDiscount,
                            AllowToExceedMonthValue = objList.AllowToExceedMonthValue,
                            AllowToExceedDayValue   = objList.AllowToExceedDayValue,
                            OnlyApplyDiscount       = objList.OnlyApplyDiscount,

                            CountOfPermissionAllowedInMonth  = objList.CountOfPermissionAllowedInMonth,
                            AllowToExceedCountAllowedInMonth = objList.AllowToExceedCountAllowedInMonth,
                            AllowedMenthodType = objList.AllowedMenthodType,
                        };

                        objPharmaEntities.Hr_EmpPermission_Settings.Add(loclDtls);
                        //saves all above operations within one transaction
                        Result = objPharmaEntities.SaveChanges();
                        return(Result > 0);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(),
                                      this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString());
                ex.InnerException.Message.ToString();
                return(false);
            }
            finally
            {
                CloseEntityConnection();
            }
        }