Ejemplo n.º 1
0
        /// <summary>
        /// 修改积分
        /// </summary>
        public bool AlertScore(XHD.Model.Personal_Score model, List <Model.Personal_Score> lstScore, DataTable dt)
        {
            List <string> strSqlList = new List <string>();
            string        strSql     = string.Empty;

            int scoreTotal = 0;

            if (lstScore != null)
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string s = dt.Rows[i]["standardId"].ToString();

                        Model.Personal_Score parm = lstScore.Find(delegate(Model.Personal_Score p) { return(p.Item_StandardId == Convert.ToInt32(dt.Rows[i]["standardId"].ToString())); }) as Model.Personal_Score;

                        scoreTotal += Convert.ToInt32(dt.Rows[i]["standardScore"].ToString());

                        strSql = string.Format(@" update Personal_Score set Factory_Id='{0}',DtypeName='{1}',DtypeId='{2}',UserName='******',UserId='{4}',ItemName='{5}',ItemId='{6}',
                                              Item_StandardId='{7}',Content='{8}',IsTure='{9}',Score='{10}',OperationName='{11}',OperationId='{12}',CreateDate='{13}' where Id='{14}'",
                                               model.Factory_Id, model.DtypeName, model.DtypeId, model.UserName, model.UserId, model.ItemName, model.ItemId, Convert.ToInt32(dt.Rows[i]["standardId"].ToString()),
                                               model.Content, model.IsTure, Convert.ToDecimal(dt.Rows[i]["standardScore"].ToString()), model.OperationName, model.OperationId, model.CreateDate, parm.Id);

                        strSqlList.Add(strSql);
                    }
                }
            }
            else
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        scoreTotal += Convert.ToInt32(dt.Rows[i]["standardScore"].ToString());

                        strSql = string.Format(@" insert into Personal_Score(Factory_Id,DtypeName,DtypeId,UserName,UserId,ItemName,ItemId,Item_StandardId,Content,IsTure,Score,OperationName,OperationId,CreateDate) 
                                                 values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')",
                                               model.Factory_Id, model.DtypeName, model.DtypeId, model.UserName, model.UserId, model.ItemName, model.ItemId, Convert.ToInt32(dt.Rows[i]["standardId"].ToString()),
                                               model.Content, model.IsTure, Convert.ToDecimal(dt.Rows[i]["standardScore"].ToString()), model.OperationName, model.OperationId, model.CreateDate);

                        strSqlList.Add(strSql);
                    }
                }
            }


            strSql = string.Format(@" update Personal_Score set Factory_Id='{0}',DtypeName='{1}',DtypeId='{2}',UserName='******',UserId='{4}',ItemName='{5}',ItemId='{6}',
                                      Item_StandardId='{7}',Content='{8}',IsTure='{9}',Score='{10}',OperationName='{11}',OperationId='{12}',CreateDate='{13}' where Id='{14}'",
                                   model.Factory_Id, model.DtypeName, model.DtypeId, model.UserName, model.UserId, model.ItemName, model.ItemId, "",
                                   model.Content, model.IsTure, scoreTotal, model.OperationName, model.OperationId, model.CreateDate, model.Id);

            strSqlList.Add(strSql);


            int rows = DbHelperMySQL.ExecuteSqlTran(strSqlList);

            if (rows >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //受理完成
        public bool finish(int id, string remark, DataSet ds, Model.ims.ims_emp_score modelScore, string scoreApply, string score)
        {
            hr_employee    emp    = new hr_employee();
            Personal_Score pscore = new Personal_Score();

            Model.Personal_Score model = new Model.Personal_Score();

            List <string> strSqlList = new List <string>();
            string        strSql     = string.Empty;

            strSql = string.Format(@"update ims_complaint_points set state='{0}',hand_data='{1}',hand_remark='{2}' where id='{3}'", 2, DateTime.Now, remark, id);
            strSqlList.Add(strSql);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                //被投诉人
                if (score != "0")
                {
                    strSql = string.Format(@"insert into  ims_emp_score(Factory_Id,d_id,d_name,emp_id,emp_name,rule_id,rule_name,isPlus,score,check_empId,check_empName,check_date,check_remark,score_source,complaint_id) 
                                   values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')",
                                           modelScore.Factory_Id, int.Parse(ds.Tables[0].Rows[0]["d_id"].ToString()), ds.Tables[0].Rows[0]["dname"].ToString(),
                                           int.Parse(ds.Tables[0].Rows[0]["sued_empId"].ToString()), ds.Tables[0].Rows[0]["sued_empName"].ToString(), modelScore.rule_id, modelScore.rule_name,
                                           modelScore.isPlus, Convert.ToDecimal(PageValidate.InputText("-" + score, 16)), modelScore.check_empId, modelScore.check_empName,
                                           modelScore.check_date, modelScore.check_remark, modelScore.score_source, id);
                    strSqlList.Add(strSql);
                }

                //申请人
                if (scoreApply != "0")
                {
                    DataSet de = emp.GetList("ID='" + ds.Tables[0].Rows[0]["apply_empId"].ToString() + "'");
                    if (de != null & de.Tables[0].Rows.Count > 0)
                    {
                        strSql = string.Format(@"insert into  ims_emp_score(Factory_Id,d_id,d_name,emp_id,emp_name,rule_id,rule_name,isPlus,score,check_empId,check_empName,check_date,check_remark,score_source,complaint_id) 
                                   values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')",
                                               modelScore.Factory_Id, int.Parse(de.Tables[0].Rows[0]["d_id"].ToString()), de.Tables[0].Rows[0]["dname"].ToString(),
                                               int.Parse(ds.Tables[0].Rows[0]["apply_empId"].ToString()), ds.Tables[0].Rows[0]["apply_empName"].ToString(), modelScore.rule_id, modelScore.rule_name,
                                               modelScore.isPlus, Convert.ToDecimal(PageValidate.InputText("-" + scoreApply, 16)), modelScore.check_empId,
                                               modelScore.check_empName, modelScore.check_date, modelScore.check_remark, modelScore.score_source, id);
                        strSqlList.Add(strSql);
                    }
                }
            }



            int rows = DbHelperMySQL.ExecuteSqlTran(strSqlList);

            if (rows >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }

            //StringBuilder strSql = new StringBuilder();
            //strSql.Append(" update ims_complaint_points set state='2',hand_data='" + DateTime.Now + "',hand_remark='" + remark + "' where id='" + id + "' ");
            //int rows = DbHelperMySQL.ExecuteSql(strSql.ToString());
            //if (rows > 0)
            //{
            //    return true;
            //}
            //else
            //{
            //    return false;
            //}
        }