Esempio n. 1
0
        public void SalaryLevelADD(T_HR_SALARYLEVEL obj)
        {
            PostLevelDistinctionBLL          plBll      = new PostLevelDistinctionBLL();
            List <T_HR_POSTLEVELDISTINCTION> postlevels = plBll.GetAllPostLevelDistinction();

            T_HR_POSTLEVELDISTINCTION tmpEnts = (from s in postlevels
                                                 where s.POSTLEVEL == obj.T_HR_POSTLEVELDISTINCTION.POSTLEVEL
                                                 select s).First();
            var ent = from a in dal.GetTable()
                      where a.SALARYLEVEL == obj.SALARYLEVEL && a.T_HR_POSTLEVELDISTINCTION.POSTLEVELID == tmpEnts.POSTLEVELID
                      select a;

            //obj.T_HR_POSTLEVELDISTINCTION = new T_HR_POSTLEVELDISTINCTION();
            //obj.T_HR_POSTLEVELDISTINCTION = tmpEnts;
            if (ent.Count() <= 0)
            {
                if (tmpEnts != null)
                {
                    obj.T_HR_POSTLEVELDISTINCTIONReference.EntityKey =
                        new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTLEVELDISTINCTION", "POSTLEVELID", tmpEnts.POSTLEVELID);
                }

                dal.Add(obj);
            }
        }
Esempio n. 2
0
        public void GenerateSalaryLevel(int lowSalaryLevel, string userid)
        {
            if (lowSalaryLevel <= 0)
            {
                return;
            }

            PostLevelDistinctionBLL plBll = new PostLevelDistinctionBLL();

            List <T_HR_POSTLEVELDISTINCTION> postlevels = plBll.GetAllPostLevelDistinction();

            foreach (var pl in postlevels)
            {
                int j = 0;

                for (int i = lowSalaryLevel; i > 0; i--)
                {
                    string tmplevel = i.ToString();

                    var tmpEnts = from s in dal.GetTable()
                                  where s.SALARYLEVEL == tmplevel &&
                                  s.T_HR_POSTLEVELDISTINCTION.POSTLEVEL == pl.POSTLEVEL
                                  select s;
                    if (tmpEnts != null && tmpEnts.Count() > 0)
                    {
                        var tmpSl = tmpEnts.FirstOrDefault();

                        tmpSl.SALARYSUM  = pl.BASICSALARY + pl.LEVELBALANCE * j;
                        tmpSl.UPDATEDATE = System.DateTime.Now;

                        dal.Update(tmpSl);
                    }
                    else
                    {
                        T_HR_SALARYLEVEL tmpSL = new T_HR_SALARYLEVEL();

                        tmpSL.SALARYLEVELID = Guid.NewGuid().ToString();
                        tmpSL.SALARYLEVEL   = i.ToString();
                        tmpSL.SALARYSUM     = pl.BASICSALARY + (pl.LEVELBALANCE * j);

                        tmpSL.CREATEDATE = System.DateTime.Now;
                        tmpSL.UPDATEDATE = System.DateTime.Now;

                        tmpSL.T_HR_POSTLEVELDISTINCTIONReference.EntityKey =
                            new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTLEVELDISTINCTION", "POSTLEVELID", pl.POSTLEVELID);

                        dal.Add(tmpSL);
                    }

                    j++;
                }
            }
        }
Esempio n. 3
0
        public void GenerateSalaryLevel(int lowSalaryLevel, int highSalaryLevel, string systemID, string userid)
        {
            //if (lowSalaryLevel <= 0)
            //    return;
            var ents = from e in dal.GetObjects().Include("T_HR_POSTLEVELDISTINCTION")
                       join c in dal.GetObjects <T_HR_POSTLEVELDISTINCTION>() on e.T_HR_POSTLEVELDISTINCTION.POSTLEVELID equals c.POSTLEVELID
                       where c.T_HR_SALARYSYSTEM.SALARYSYSTEMID == systemID
                       select e;

            if (ents.Count() > 0)
            {
                foreach (var ent in ents)
                {
                    dal.DeleteFromContext(ent);
                }
            }
            dal.SaveContextChanges();



            PostLevelDistinctionBLL plBll = new PostLevelDistinctionBLL();

            //  List<T_HR_POSTLEVELDISTINCTION> postlevels = plBll.GetAllPostLevelDistinction();
            List <T_HR_POSTLEVELDISTINCTION> postlevels = plBll.GetPostLevelDistinctionBySystemID(systemID);

            foreach (var pl in postlevels)
            {
                int j = 0;

                for (int i = lowSalaryLevel; i >= highSalaryLevel; i--)
                {
                    string tmplevel = i.ToString();

                    var tmpEnts = from s in dal.GetTable()
                                  where s.SALARYLEVEL == tmplevel &&
                                  s.T_HR_POSTLEVELDISTINCTION.POSTLEVELID == pl.POSTLEVELID
                                  select s;
                    if (tmpEnts != null && tmpEnts.Count() > 0)
                    {
                        var tmpSl = tmpEnts.FirstOrDefault();

                        tmpSl.SALARYSUM    = pl.BASICSALARY + pl.LEVELBALANCE * j;
                        tmpSl.UPDATEDATE   = System.DateTime.Now;
                        tmpSl.UPDATEUSERID = userid;
                        dal.Update(tmpSl);
                    }
                    else
                    {
                        T_HR_SALARYLEVEL tmpSL = new T_HR_SALARYLEVEL();

                        tmpSL.SALARYLEVELID = Guid.NewGuid().ToString();
                        tmpSL.SALARYLEVEL   = i.ToString();
                        tmpSL.SALARYSUM     = pl.BASICSALARY + (pl.LEVELBALANCE * j);

                        tmpSL.CREATEDATE   = System.DateTime.Now;
                        tmpSL.UPDATEDATE   = System.DateTime.Now;
                        tmpSL.CREATEUSERID = userid;
                        tmpSL.T_HR_POSTLEVELDISTINCTIONReference.EntityKey =
                            new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTLEVELDISTINCTION", "POSTLEVELID", pl.POSTLEVELID);

                        dal.Add(tmpSL);
                    }

                    j++;
                }
            }
        }