Esempio n. 1
0
        public Hr_GradeJobGroups GetByIdWithOutBranch(string strGradeJob_Id)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();


            try
            {
                OpenEntityConnection();
                Hr_GradeJobGroups AdminsForGetEntity = (from objLinq in objPharmaEntities.Hr_GradeJobGroups
                                                        where objLinq.GradeJob_Id == strGradeJob_Id && objLinq.Rec_Status == 0
                                                        select objLinq).FirstOrDefault();
                return(AdminsForGetEntity);
            }
            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();
            }
        }
Esempio n. 2
0
        public List <Hr_GradeJobGroups> SelectAll()
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            try
            {
                List <Hr_GradeJobGroups> objlist = new List <Hr_GradeJobGroups>();

                OpenEntityConnection();
                string sql = "select [Company_Id],[Branch_Id],[GradeJob_Code]";
                sql = sql + ",[GradeJob_Id],[GradeJob_Name],[GradeJob_NameEn],[GradeJob_NameConv],[GradeJob_AccountNo],[InsUser],[InsDate]";
                sql = sql + ",[UpdateUser],UpdateDate,DeleteUser,DeleteDate,Rec_Status,Prefix,Id";

                sql = sql + " from Hr_GradeJobGroups where Rec_Status = 0 ";
                sql = sql + " Order by Id";
                //  List<Hr_GradeJobGroups> objectList = (from objLinq in objPharmaEntities.Hr_GradeJobGroups
                //                       where objLinq.Rec_Status == 0 && objLinq.Branch_Id == strbranch && objLinq.Company_Id == strcomapny
                //              select objLinq).ToList();



                List <Hr_GradeJobGroups> objectlist = objPharmaEntities.Database.SqlQuery <Hr_GradeJobGroups>(sql).ToList();

                if (objectlist != null)
                {
                    foreach (var obj in objectlist)
                    {
                        Hr_GradeJobGroups objHr_GradeJobGroups = new Hr_GradeJobGroups();
                        objHr_GradeJobGroups.Company_Id         = obj.Company_Id;
                        objHr_GradeJobGroups.Branch_Id          = obj.Branch_Id;
                        objHr_GradeJobGroups.GradeJob_Code      = obj.GradeJob_Code;
                        objHr_GradeJobGroups.GradeJob_Id        = obj.GradeJob_Id;
                        objHr_GradeJobGroups.GradeJob_Name      = obj.GradeJob_Name;
                        objHr_GradeJobGroups.GradeJob_NameEn    = obj.GradeJob_NameEn;
                        objHr_GradeJobGroups.GradeJob_AccountNo = obj.GradeJob_AccountNo;
                        objHr_GradeJobGroups.Prefix             = obj.Prefix;



                        objlist.Add(objHr_GradeJobGroups);
                    }
                }

                return(objlist);
            }
            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();
            }
        }
Esempio n. 3
0
        public bool UpdateTaskWithOutBranch(Hr_GradeJobGroups objUpdate)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            // bool task = Update(objInsert).Result;
            //return task;
            int rowEffected = 0;

            try
            {
                if (objUpdate != null) //Definsive Programming
                {
                    OpenEntityConnection();
                    Hr_GradeJobGroups ObjForUpdate = (from objLinq in objPharmaEntities.Hr_GradeJobGroups
                                                      where objLinq.GradeJob_Id == objUpdate.GradeJob_Id
                                                      //&& objLinq.Company_Id == objUpdate.Company_Id && objLinq.Branch_Id == objUpdate.Branch_Id
                                                      select objLinq).FirstOrDefault();



                    if (ObjForUpdate != null)
                    {
                        ObjForUpdate.GradeJob_Name      = objUpdate.GradeJob_Name;
                        ObjForUpdate.GradeJob_NameEn    = objUpdate.GradeJob_NameEn;
                        ObjForUpdate.GradeJob_NameConv  = objUpdate.GradeJob_NameConv;
                        ObjForUpdate.GradeJob_AccountNo = objUpdate.GradeJob_AccountNo;
                        ObjForUpdate.GradeJob_Code      = objUpdate.GradeJob_Code;

                        ObjForUpdate.UpdateUser = objUpdate.UpdateUser;
                        ObjForUpdate.UpdateDate = DateTime.Now;

                        rowEffected = objPharmaEntities.SaveChanges();
                    }
                }
            }
            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());
                rowEffected = -1;
                ex.InnerException.Message.ToString();
            }
            finally
            {
                CloseEntityConnection();
            }
            if (rowEffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        public async Task <bool> Delete(Hr_GradeJobGroups objDelete)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            int rowEffected = 0;

            try
            {
                if (objDelete != null) //Definsive Programming
                {
                    OpenEntityConnection();
                    Hr_GradeJobGroups objForDelete = (from objLinq in objPharmaEntities.Hr_GradeJobGroups
                                                      where objLinq.GradeJob_Id == objDelete.GradeJob_Id && objLinq.Company_Id == objDelete.Company_Id && objLinq.Branch_Id == objDelete.Branch_Id
                                                      select objLinq).FirstOrDefault();
                    objForDelete.Rec_Status = 1;
                    objForDelete.DeleteUser = objDelete.DeleteUser;
                    objForDelete.DeleteDate = DateTime.Now;

                    rowEffected = await objPharmaEntities.SaveChangesAsync();
                }
            }
            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());
                rowEffected = -1;
                ex.InnerException.Message.ToString();
            }
            finally
            {
                CloseEntityConnection();
            }
            if (rowEffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        // Calling the method of using Async
        //public  int test() {
        //    int task =  Insert().Result;
        //    return task;

        //}
        public int InsertTask(Hr_GradeJobGroups objInsert)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            //int result = Insert(objInsert).Result;
            //return result;

            int RowEffected = 0;

            try
            {
                if (objInsert != null)
                {
                    OpenEntityConnection();
                    objInsert.InsDate = DateTime.Now;//DateTime.Today;


                    objPharmaEntities.Hr_GradeJobGroups.Add(objInsert);
                    RowEffected = objPharmaEntities.SaveChanges();
                }
            }
            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());

                RowEffected = -1;
                ex.InnerException.Message.ToString();
            }
            finally
            {
                CloseEntityConnection();
            }
            return(RowEffected);
        }