Beispiel #1
0
 /// <summary>
 /// 年休假设置信息添加
 /// </summary>
 /// <param name="YearHolidayM">YearHolidayM</param>
 /// <param name="StrYearHoliday">年休假设置信息</param>
 /// <returns>添加是否成功 false:失败,true:成功</returns>
 public static string  AddYearHolidayInfoSet(YearHolidayModel YearHolidayM, string StrYearHoliday)
 {
     return(YearHolidayDBHelper.AddYearHolidayInfoSet(YearHolidayM, StrYearHoliday));
 }
Beispiel #2
0
        /// <summary>
        /// 年休假设置信息添加
        /// </summary>
        /// <param name="YearHolidayM">YearHolidayM</param>
        /// <param name="StrYearHoliday">年休假设置信息</param>
        /// <returns>添加是否成功 false:失败,true:成功</returns>
        public static string  AddYearHolidayInfoSet(YearHolidayModel YearHolidayM, string StrYearHoliday)
        {
            string[] strarray    = null;
            string   recorditems = "";

            string[] inseritems = null;
            string   ErrMsg     = "";

            try
            {
                strarray = StrYearHoliday.Split('|');
                for (int i = 0; i < strarray.Length; i++)
                {
                    StringBuilder StrYearHolidaySql = new StringBuilder();
                    recorditems = strarray[i];
                    inseritems  = recorditems.Split(',');
                    if (recorditems.Length != 0)
                    {
                        string EmployeeID   = inseritems[0].ToString().Trim(); //员工ID
                        string HolidayHours = inseritems[1].ToString().Trim(); //时长
                        string UserName     = inseritems[2].ToString().Trim(); //姓名
                        if (YearHolidayIsExist(EmployeeID) == 0)               //插入
                        {
                            #region 添加SQL
                            StrYearHolidaySql.AppendLine("INSERT INTO officedba.YearHoliday");
                            StrYearHolidaySql.AppendLine("		(CompanyCD      ");
                            StrYearHolidaySql.AppendLine("		,EmployeeID        ");
                            StrYearHolidaySql.AppendLine("		,HolidayHours        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedDate        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedUserID)        ");
                            StrYearHolidaySql.AppendLine("VALUES                  ");
                            StrYearHolidaySql.AppendLine("		('"+ YearHolidayM.CompanyCD + "'     ");
                            StrYearHolidaySql.AppendLine("		,"+ Convert.ToInt32(EmployeeID) + "       ");
                            StrYearHolidaySql.AppendLine("		,"+ Convert.ToDecimal(HolidayHours) + "       ");
                            StrYearHolidaySql.AppendLine("		,'"+ YearHolidayM.ModifiedDate + "'       ");
                            StrYearHolidaySql.AppendLine("		,'"+ YearHolidayM.ModifiedUserID + "')       ");
                            #endregion
                        }
                        else//更新
                        {
                            #region 更新SQL
                            StrYearHolidaySql.AppendLine("UPDATE officedba.YearHoliday");
                            StrYearHolidaySql.AppendLine("	SET	CompanyCD='"+ YearHolidayM.CompanyCD + "'      ");
                            StrYearHolidaySql.AppendLine("		,HolidayHours="+ Convert.ToDecimal(HolidayHours) + "        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedDate='"+ YearHolidayM.ModifiedDate + "'        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedUserID='"+ YearHolidayM.ModifiedUserID + "'      ");
                            StrYearHolidaySql.AppendLine("		WHERE EmployeeID="+ Convert.ToInt32(EmployeeID) + "      ");
                            #endregion
                        }
                        SqlHelper.ExecuteTransSql(StrYearHolidaySql.ToString());
                        if (SqlHelper.Result.OprateCount <= 0)
                        {
                            ErrMsg = UserName + ',';
                        }
                    }
                }
                return(ErrMsg);
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }