示例#1
0
        // Calling the method of using Async
        //public  int test() {
        //    int task =  Insert().Result;
        //    return task;

        //}
        public int InsertTask(Hr_Hiring_Items 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_Hiring_Items.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);
        }
示例#2
0
        public Hr_Hiring_Items GetByIdWithOutBranch(string HireItem_Id)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();


            try
            {
                OpenEntityConnection();
                Hr_Hiring_Items JobsForGetEntity = (from objLinq in objPharmaEntities.Hr_Hiring_Items
                                                    where objLinq.HireItem_Id == HireItem_Id && objLinq.Rec_Status == 0
                                                    select objLinq).FirstOrDefault();
                return(JobsForGetEntity);
            }
            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();
            }
        }
示例#3
0
        public bool UpdateTaskWithOutBranch(Hr_Hiring_Items 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_Hiring_Items ObjForUpdate = (from objLinq in objPharmaEntities.Hr_Hiring_Items
                                                    where objLinq.HireItem_Id == objUpdate.HireItem_Id
                                                    //&& objLinq.Company_Id == objUpdate.Company_Id && objLinq.Branch_Id == objUpdate.Branch_Id
                                                    select objLinq).FirstOrDefault();
                    ObjForUpdate.HireItem_Name   = objUpdate.HireItem_Name;
                    ObjForUpdate.HireItem_NameEn = objUpdate.HireItem_NameEn;

                    ObjForUpdate.HireItem_Type       = objUpdate.HireItem_Type;
                    ObjForUpdate.Account_Type        = objUpdate.Account_Type;
                    ObjForUpdate.Hire_Appear_W_Grade = objUpdate.Hire_Appear_W_Grade;
                    ObjForUpdate.JoinEndOfService    = objUpdate.JoinEndOfService;
                    ObjForUpdate.CalcAnnually        = objUpdate.CalcAnnually;

                    ObjForUpdate.NotIncludeVacAllownce   = objUpdate.NotIncludeVacAllownce;
                    ObjForUpdate.AffectsSalaries         = objUpdate.AffectsSalaries;
                    ObjForUpdate.Hire_AppearOnlyW_Grades = objUpdate.Hire_AppearOnlyW_Grades;
                    ObjForUpdate.Hire_Status             = 0;
                    ObjForUpdate.IsPaymentBorrow         = objUpdate.IsPaymentBorrow;
                    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);
            }
        }
示例#4
0
        public async Task <bool> Update(Hr_Hiring_Items objUpdate)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            int rowEffected = 0;

            try
            {
                if (objUpdate != null) //Definsive Programming
                {
                    OpenEntityConnection();
                    Hr_Hiring_Items ObjForUpdate = (from objLinq in objPharmaEntities.Hr_Hiring_Items
                                                    where objLinq.HireItem_Id == objUpdate.HireItem_Id
                                                    select objLinq).FirstOrDefault();
                    ObjForUpdate.HireItem_Name   = objUpdate.HireItem_Name;
                    ObjForUpdate.HireItem_NameEn = objUpdate.HireItem_NameEn;
                    ObjForUpdate.HireItem_Type   = objUpdate.HireItem_Type;
                    ObjForUpdate.UpdateUser      = objUpdate.UpdateUser;
                    ObjForUpdate.UpdateDate      = 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);
            }
        }
示例#5
0
        public bool DeleteTaskWithOutBranch(Hr_Hiring_Items objDelete)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

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

            try
            {
                if (objDelete != null) //Definsive Programming
                {
                    OpenEntityConnection();
                    Hr_Hiring_Items objForDelete = (from objLinq in objPharmaEntities.Hr_Hiring_Items
                                                    where objLinq.HireItem_Id == objDelete.HireItem_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 = 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);
            }
        }