示例#1
0
        /// <summary>
        /// Overhead Cost
        /// </summary>
        /// <param name="overheadCost">overheadCost</param>
        /// <returns>number of Overhead cost is update</returns>
        public int EditOverheadCostData(OverHeadCostPlus overheadCost)
        {
            int res = 0;
            Sql sql;

            if (overheadCost.overhead_cost_id > 0)
            {
                IDictionary <string, object> columns = new Dictionary <string, object>()
                {
                    { "overhead_cost_type", overheadCost.overhead_cost_type.Trim() }
                    , { "remarks", overheadCost.remarks }
                    , { "ins_date", overheadCost.ins_date }
                    , { "ins_id", overheadCost.ins_id }
                };

                IDictionary <string, object> condition = new Dictionary <string, object>()
                {
                    { "overhead_cost_id", overheadCost.overhead_cost_id },
                    { "company_code", overheadCost.company_code }
                };


                if (Update <OverHeadCostPlus>(columns, condition) > 0)
                {
                    res = overheadCost.overhead_cost_id;
                }
            }
            else
            {
                sql = new Sql(@"
                INSERT INTO m_overhead_cost
                       (company_code
                       ,overhead_cost_type
                       ,remarks
                       ,ins_date
                       ,ins_id)
                 VALUES
                       (
                       @company_code,
                       @overhead_cost_type,
                       @remarks,
                       @ins_date,
                       @ins_id)"
                              , new { company_code = overheadCost.company_code }
                              , new { overhead_cost_type = overheadCost.overhead_cost_type.Trim() }
                              , new { remarks = overheadCost.remarks }
                              , new { ins_date = overheadCost.ins_date }
                              , new { ins_id = overheadCost.ins_id }
                              );

                if (_database.Execute(sql) > 0)
                {
                    var query = "SELECT ident_current('m_overhead_cost')";
                    res = _database.ExecuteScalar <int>(query);
                }
            }

            return(res);
        }
 public PMS10005EditViewModel()
 {
     OVERHEAD_COST = new OverHeadCostPlus();
 }
示例#3
0
 /// <summary>
 /// Edit Overhead Cost
 /// </summary>
 /// <param name="data">data</param>
 /// <returns>record is edit</returns>
 public int EditOverheadCostData(OverHeadCostPlus data)
 {
     return(this._repository.EditOverheadCostData(data));
 }