示例#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);
            }
        }
示例#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++;
                }
            }
        }