/// <summary>
        /// 添加一条项目报销项规则
        /// </summary>
        /// <param name="rule"></param>
        public void AddProjectReimRule(ProjectReimRule rule)
        {
            try
            {
                string commandString = "INSERT INTO usta_ProjectReimRule(projectId, reimId, reimValue, maxReimValue, createdTime) VALUES(@projectId, @reimId, @reimValue, @maxReimValue, @createdTime)";

                SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@projectId", rule.project.id),
                new SqlParameter("@reimId", rule.reim.id),
                new SqlParameter("@reimValue", rule.reimValue),
                new SqlParameter("@maxReimValue", rule.maxReimValue),
                new SqlParameter("@createdTime", DateTime.Now)
            };

                SqlHelper.ExecuteNonQuery(conn, CommandType.Text, commandString, parameters);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
        }
示例#2
0
        protected void AddReimRule_Click(object sender, EventArgs e)
        {
            int projectId = int.Parse(this.hf_ProjectId.Value.Trim());
            int reimId = int.Parse(this.ddlReimLists.SelectedValue.Trim());
            float reimValue = CommonUtility.ConvertFormatedFloat("{0:0.00}", this.tb_reimValue.Text);

            float maxReimValue = CommonUtility.ConvertFormatedFloat("{0:0.00}", this.tb_maxReimValue.Text);

            ProjectReimRule reimRule = new ProjectReimRule()
            {
                project = new Project() { id = projectId },
                reim = new Reim() { id = reimId },
                reimValue = reimValue,
                maxReimValue = maxReimValue
            };

            DalOperationAboutProjectReimRule dalRule = new DalOperationAboutProjectReimRule();
            dalRule.AddProjectReimRule(reimRule);
            Javascript.Alert("操作成功", Page);

            Javascript.RefreshParentWindowReload(Page);
        }
        private void BuildReimRule(IDataReader dataReader, List<ProjectReimRule> projectReimRules)
        {
            ProjectReimRule rule;
            while(dataReader.Read()){
                rule = new ProjectReimRule();
                rule.ruleId = int.Parse(dataReader["ruleId"].ToString().Trim());

                rule.project = new Project
                {
                    id = int.Parse(dataReader["projectId"].ToString().Trim()),
                    name = dataReader["projectName"].ToString().Trim()
                };

                rule.reim = new Reim
                {
                    id = int.Parse(dataReader["reimId"].ToString().Trim()),
                    name = dataReader["reimName"].ToString().Trim()
                };

                rule.reimValue = CommonUtility.ConvertFormatedFloat("{0:0.00}", dataReader["reimValue"].ToString().Trim());
                rule.maxReimValue = CommonUtility.ConvertFormatedFloat("{0:0.00}", dataReader["maxReimValue"].ToString().Trim());
                projectReimRules.Add(rule);
            }
        }
        /// <summary>
        /// 更新一条项目报销项规则
        /// </summary>
        /// <param name="rule"></param>
        public void UpdateProjectReimRule(ProjectReimRule rule)
        {
            try
            {
                string commandString = "UPDATE usta_ProjectReimRule SET projectId=@projectId, reimId=@reimId, reimValue = @reimValue, maxReimValue = @maxReimValue WHERE ruleId = @ruleId";
                SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ruleId", rule.ruleId),
                new SqlParameter("@projectId", rule.project.id),
                new SqlParameter("@reimId", rule.reim.id),
                new SqlParameter("@reimValue", rule.reimValue),
                new SqlParameter("@maxReimValue", rule.maxReimValue)
            };

                SqlHelper.ExecuteNonQuery(conn, CommandType.Text, commandString, parameters);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
        }