Exemplo n.º 1
0
        private RS_ScoreManageModel _DataBind(int Code)
        {
            RS_ScoreManageModel model   = new RS_ScoreManageModel();
            StringBuilder       builder = new StringBuilder();

            builder.Append("select * from RS_ScoreManage ");
            builder.Append(" where Code=@Code");
            this._DataProcess.CommandText = builder.ToString();
            this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, Code);
            SqlDataReader sqlDataReader = null;

            try
            {
                try
                {
                    sqlDataReader = this._DataProcess.GetSqlDataReader();
                    while (sqlDataReader.Read())
                    {
                        this.Initialize(sqlDataReader, model);
                    }
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                }
            }
            return(model);
        }
Exemplo n.º 2
0
 private void Initialize(SqlDataReader reader, RS_ScoreManageModel obj)
 {
     if (reader.GetValue(0) != DBNull.Value)
     {
         obj.Code = reader.GetInt32(0);
     }
     if (reader.GetValue(1) != DBNull.Value)
     {
         obj.DeptCode = reader.GetString(1);
     }
     if (reader.GetValue(2) != DBNull.Value)
     {
         obj.Marker = reader.GetString(2);
     }
     if (reader.GetValue(3) != DBNull.Value)
     {
         obj.MarkDate = reader.GetDateTime(3);
     }
     if (reader.GetValue(4) != DBNull.Value)
     {
         obj.Type = reader.GetInt32(4);
     }
     if (reader.GetValue(5) != DBNull.Value)
     {
         obj.Status = reader.GetString(5);
     }
 }
Exemplo n.º 3
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        RS_ScoreManageBFL   smBFL       = new RS_ScoreManageBFL();
        RS_EmployScoreBFL   esBFL       = new RS_EmployScoreBFL();
        RS_EmployScoreModel es          = new RS_EmployScoreModel();
        RS_ScoreManageModel tempSmModel = new RS_ScoreManageModel();

        //tempSmModel.DeptCode = Request.QueryString["UnitCode"];
        tempSmModel.Marker = user.UserCode;
        //tempSmModel.MarkDate = smBFL.GetMonthFirstDate(DateTime.Now);
        tempSmModel.MarkDate = dt;
        tempSmModel.Type     = Int32.Parse(ScoreType.Manager.ToString("d"));
        tempSmModel.Status   = WorkFlowStatus.Apply.ToString("d").ToString();
        int tempCode = smBFL.Insert(tempSmModel);

        foreach (GridViewRow gvRow in GridView1.Rows)
        {
            int score = -1;
            es = new RS_EmployScoreModel();
            TextBox tbScore = (TextBox)(gvRow.FindControl("ScoreTextBox"));
            //HtmlInputHidden hidUserCode = (HtmlInputHidden)(gvRow.FindControl("HidUserCode"));
            //es.UserCode = hidUserCode.Value;
            es.UserCode = gvRow.Cells[1].Text;
            Int32.TryParse(tbScore.Text, out score);
            es.Score      = score;
            es.ManageCode = tempCode;
            esBFL         = new RS_EmployScoreBFL();
            esBFL.Insert(es);
        }
        Response.Redirect("RS_ScoreForManagerEdit.aspx?FKCode=" + tempCode.ToString() + "&UserCode=" + user.UserCode + "");
    }
Exemplo n.º 4
0
    public void SaveButton_Click(object sender, EventArgs e)
    {
        RS_ScoreManageModel smModel = new RS_ScoreManageModel();
        RS_EmployScoreModel esModel = new RS_EmployScoreModel();
        RS_EmployScoreBFL   esBFL;

        smModel.MarkDate = bfl.GetMonthFirstDate(DateTime.Now);
        smModel.Marker   = user.UserCode;
        smModel.Status   = WorkFlowStatus.Audited.ToString("d");
        smModel.Type     = Int32.Parse(ScoreType.Dept.ToString("d"));
        int manageCode = bfl.Insert(smModel);

        foreach (GridViewRow gvRow in GridView1.Rows)
        {
            HtmlInputHidden hidDeptCode = (HtmlInputHidden)(gvRow.FindControl("HidUnitCode"));
            TextBox         tbScore     = (TextBox)(gvRow.FindControl("ScoreTextBox"));
            esModel.ManageCode = manageCode;
            esModel.UserCode   = hidDeptCode.Value;
            int score = 1;
            Int32.TryParse(tbScore.Text.Trim(), out score);
            esModel.Score = score;
            esBFL         = new RS_EmployScoreBFL();
            esBFL.Insert(esModel);
        }

        Response.Write("<script> window.opener.location.reload();window.close();</script>");
    }
Exemplo n.º 5
0
        public int Update(RS_ScoreManageModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new RS_ScoreManageBLL().Update(ObjModel, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Exemplo n.º 6
0
        public int ModifyPassAuditing(int Code, SqlTransaction Transaction)
        {
            RS_ScoreManageModel objModel = this.GetModel(Code, Transaction);

            objModel.Status = "2";
            return(this.Update(objModel, Transaction));
        }
Exemplo n.º 7
0
        private int _Insert(RS_ScoreManageModel mObj)
        {
            StringBuilder builder  = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();

            builder.Append("INSERT INTO RS_ScoreManage (");
            builder2.Append("VALUES(");
            if (mObj.DeptCode != null)
            {
                builder.Append("DeptCode,");
                builder2.Append("@DeptCode,");
                this._DataProcess.ProcessParametersAdd("@DeptCode", SqlDbType.VarChar, 10, mObj.DeptCode);
            }
            if (mObj.Marker != null)
            {
                builder.Append("Marker,");
                builder2.Append("@Marker,");
                this._DataProcess.ProcessParametersAdd("@Marker", SqlDbType.VarChar, 10, mObj.Marker);
            }
            if (mObj.MarkDate != DateTime.MinValue)
            {
                builder.Append("MarkDate,");
                builder2.Append("@MarkDate,");
                this._DataProcess.ProcessParametersAdd("@MarkDate", SqlDbType.DateTime, 8, mObj.MarkDate);
            }
            if (mObj.Type != -1)
            {
                builder.Append("Type,");
                builder2.Append("@Type,");
                this._DataProcess.ProcessParametersAdd("@Type", SqlDbType.Int, 4, mObj.Type);
            }
            if (mObj.Status != null)
            {
                builder.Append("Status,");
                builder2.Append("@Status,");
                this._DataProcess.ProcessParametersAdd("@Status", SqlDbType.VarChar, 2, mObj.Status);
            }
            builder.Remove(builder.Length - 1, 1);
            builder2.Remove(builder2.Length - 1, 1);
            builder.Append(") ");
            builder2.Append(") ");
            builder.Append(builder2.ToString());
            builder.Append("SELECT @Code = SCOPE_IDENTITY()");
            this._DataProcess.CommandText = builder.ToString();
            SqlParameter parameter = this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, null);

            parameter.Direction = ParameterDirection.Output;
            this._DataProcess.RunSql();
            mObj.Code = (int)parameter.Value;
            return(mObj.Code);
        }
Exemplo n.º 8
0
        private List <RS_ScoreManageModel> _Select(RS_ScoreManageQueryModel qmObj)
        {
            List <RS_ScoreManageModel> list = new List <RS_ScoreManageModel>();
            StringBuilder builder           = new StringBuilder();

            builder.Append("select * from RS_ScoreManage ");
            builder.Append(qmObj.QueryConditionStr);
            if (qmObj.SortColumns.Length == 0)
            {
                builder.Append(" ORDER BY Code desc");
            }
            else
            {
                builder.Append(" ORDER BY " + qmObj.SortColumns);
            }
            this._DataProcess.CommandText   = builder.ToString();
            this._DataProcess.SqlParameters = qmObj.Parameters;
            SqlDataReader sqlDataReader = null;
            int           num           = 0;

            try
            {
                try
                {
                    sqlDataReader = this._DataProcess.GetSqlDataReader();
                    while (sqlDataReader.Read())
                    {
                        if ((num >= qmObj.StartRecord) && ((list.Count < qmObj.MaxRecords) || (qmObj.MaxRecords == -1)))
                        {
                            RS_ScoreManageModel model = new RS_ScoreManageModel();
                            this.Initialize(sqlDataReader, model);
                            list.Add(model);
                        }
                        num++;
                    }
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                }
            }
            return(list);
        }
Exemplo n.º 9
0
        public RS_ScoreManageModel GetRS_ScoreManage(int Code)
        {
            RS_ScoreManageModel model = new RS_ScoreManageModel();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    model = new RS_ScoreManageBLL().GetModel(Code, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(model);
        }
Exemplo n.º 10
0
        private int _Update(RS_ScoreManageModel mObj)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update RS_ScoreManage set ");
            if (mObj.DeptCode != null)
            {
                builder.Append("DeptCode=@DeptCode,");
                this._DataProcess.ProcessParametersAdd("@DeptCode", SqlDbType.VarChar, 10, mObj.DeptCode);
            }
            if (mObj.Marker != null)
            {
                builder.Append("Marker=@Marker,");
                this._DataProcess.ProcessParametersAdd("@Marker", SqlDbType.VarChar, 10, mObj.Marker);
            }
            if (mObj.MarkDate != DateTime.MinValue)
            {
                builder.Append("MarkDate=@MarkDate,");
                this._DataProcess.ProcessParametersAdd("@MarkDate", SqlDbType.DateTime, 8, mObj.MarkDate);
            }
            if (mObj.Type != 0)
            {
                builder.Append("Type=@Type,");
                this._DataProcess.ProcessParametersAdd("@Type", SqlDbType.Int, 4, mObj.Type);
            }
            if (mObj.Status != null)
            {
                builder.Append("Status=@Status,");
                this._DataProcess.ProcessParametersAdd("@Status", SqlDbType.VarChar, 2, mObj.Status);
            }
            builder.Remove(builder.Length - 1, 1);
            builder.Append(" where Code=@Code");
            this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, mObj.Code);
            this._DataProcess.CommandText = builder.ToString();
            return(this._DataProcess.RunSql());
        }
Exemplo n.º 11
0
 public int Update(RS_ScoreManageModel mObj)
 {
     return(this._Update(mObj));
 }
Exemplo n.º 12
0
 public int Insert(RS_ScoreManageModel mObj)
 {
     return(this._Insert(mObj));
 }
Exemplo n.º 13
0
 public int Delete(RS_ScoreManageModel mObj)
 {
     return(this._Delete(mObj.Code));
 }
Exemplo n.º 14
0
        public List <EmployScoreMode> GetEmployScore(string deptCode, DateTime dtNow, SearchType st)
        {
            int num;
            RS_ScoreManageQueryModel   model  = new RS_ScoreManageQueryModel();
            RS_ScoreManageModel        model2 = new RS_ScoreManageModel();
            List <RS_ScoreManageModel> list   = new List <RS_ScoreManageModel>();
            DateTime dt = this.GetMonthFirstDate(dtNow);

            list = this.GetManageCode(deptCode, dt, ScoreType.Employ);
            if (list.Count == 0)
            {
                if (st == SearchType.Search)
                {
                    return(null);
                }
                for (num = 12; (list.Count == 0) && (num > 0); num--)
                {
                    dt   = dt.AddMonths(-1);
                    list = this.GetManageCode(deptCode, dt, ScoreType.Employ);
                }
                if (list.Count == 0)
                {
                    return(null);
                }
            }
            else
            {
                int code = list[0].Code;
                if (int.Parse(list[0].Status) < int.Parse(WorkFlowStatus.Audited.ToString("d")))
                {
                    for (num = 12; (list.Count == 0) && (num > 0); num--)
                    {
                        if (st == SearchType.Search)
                        {
                            return(null);
                        }
                        dt   = dt.AddMinutes(-1);
                        list = this.GetManageCode(deptCode, dt, ScoreType.Employ);
                    }
                    if (list.Count == 0)
                    {
                        return(null);
                    }
                }
            }
            List <RS_EmployScoreModel> userScoreListByManageCode = new List <RS_EmployScoreModel>();

            userScoreListByManageCode = this.GetUserScoreListByManageCode(list[0].Code);
            string                 userNameByUserID = this.GetUserNameByUserID(list[0].Marker);
            string                 deptNameByDeptID = this.GetDeptNameByDeptID(list[0].DeptCode);
            EmployScoreMode        item             = new EmployScoreMode();
            List <EmployScoreMode> list3            = new List <EmployScoreMode>();
            RS_ScoreExtend         extend           = new RS_ScoreExtend();

            foreach (RS_EmployScoreModel model3 in userScoreListByManageCode)
            {
                item           = new EmployScoreMode();
                item.UserCode  = model3.UserCode;
                item.UserName  = extend.GetUserNameByCode(model3.UserCode);
                item.Score     = model3.Score.ToString();
                item.DeptCode  = list[0].DeptCode;
                item.DeptName  = deptNameByDeptID;
                item.Marker    = userNameByUserID;
                item.ScoreCode = model3.Code;
                item.MarkTime  = list[0].MarkDate.ToString();
                item.Status    = list[0].Status;
                list3.Add(item);
            }
            return(list3);
        }
Exemplo n.º 15
0
        public int Insert(RS_ScoreManageModel ObjModel, SqlTransaction Transaction)
        {
            RS_ScoreManageDAL edal = new RS_ScoreManageDAL(Transaction);

            return(edal.Insert(ObjModel));
        }
Exemplo n.º 16
0
        public int Update(RS_ScoreManageModel ObjModel, SqlTransaction Transaction)
        {
            RS_ScoreManageDAL edal = new RS_ScoreManageDAL(Transaction);

            return(edal.Update(ObjModel));
        }