Exemple #1
0
        private int _Insert(ProjectCostModel mObj)
        {
            int projectCostCode;

            try
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("insert into ProjectCost(");
                builder.Append("ProjectCostCode,ProjectName,GroupCode,Area,Price,Money,Qty,Unit,InputPerson,InputDate,Remark)");
                builder.Append(" values (");
                builder.Append("@ProjectCostCode,@ProjectName,@GroupCode,@Area,@Price,@Money,@Qty,@Unit,@InputPerson,@InputDate,@Remark) ");
                this._DataProcess.CommandText = builder.ToString();
                this._DataProcess.ProcessParametersAdd("@ProjectCostCode", SqlDbType.Int, 4, mObj.ProjectCostCode);
                this._DataProcess.ProcessParametersAdd("@ProjectName", SqlDbType.VarChar, 100, mObj.ProjectName);
                this._DataProcess.ProcessParametersAdd("@GroupCode", SqlDbType.VarChar, 50, mObj.GroupCode);
                this._DataProcess.ProcessParametersAdd("@Area", SqlDbType.Decimal, 9, mObj.Area);
                this._DataProcess.ProcessParametersAdd("@Price", SqlDbType.Decimal, 9, mObj.Price);
                this._DataProcess.ProcessParametersAdd("@Money", SqlDbType.Decimal, 9, mObj.Money);
                this._DataProcess.ProcessParametersAdd("@Qty", SqlDbType.Decimal, 9, mObj.Qty);
                this._DataProcess.ProcessParametersAdd("@Unit", SqlDbType.VarChar, 50, mObj.Unit);
                this._DataProcess.ProcessParametersAdd("@InputPerson", SqlDbType.VarChar, 50, mObj.InputPerson);
                this._DataProcess.ProcessParametersAdd("@InputDate", SqlDbType.DateTime, 8, mObj.InputDate);
                this._DataProcess.ProcessParametersAdd("@Remark", SqlDbType.VarChar, 800, mObj.Remark);
                this._DataProcess.RunSql();
                projectCostCode = mObj.ProjectCostCode;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(projectCostCode);
        }
Exemple #2
0
        public void Delete(ProjectCostModel model)
        {
            string sql = @"DELETE FROM prj_project_costs WHERE proj_cost_id = @proj_cost_id";

            object[] parms = { "@proj_cost_id", model.Id };
            db.Update(sql, parms);
        }
Exemple #3
0
        private void Selecting_Row(object sender, EventArgs e)
        {
            MetroGrid grid = sender as MetroGrid;

            if (grid.SelectedRows.Count > 0)
            {
                List <ProjectCostModel> prjs = new List <ProjectCostModel>(); // grid.SelectedRows.DataBoundItem;
                foreach (DataGridViewRow item in grid.SelectedRows)
                {
                    try
                    {
                        ProjectCostModel prj = (ProjectCostModel)item.DataBoundItem;
                        prjs.Add(prj);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                if (prjs.Count != 0)
                {
                    _view.projCostSelected = prjs;
                }
            }
        }
Exemple #4
0
 private object[] Take(ProjectCostModel model)
 {
     return(new object[]
     {
         "@proj_cost_id", model.Id,
         "@line_num", model.LineNum,
         "@project_id", model.ProjectId,
         "@project_num", model.ProjectNum,
         "@cost_id", model.CostId,
         "@cost_code", model.CostCode,
         "@orig_amt", model.OrigAmount,
         "@plan_cost", model.BudgetCostAmount,
         "@fcst_cost", model.FcstCostAmount,
         "@act_cost", model.ActCostAmount,
         "@uf_ctg_amt", model.CTGAmount,
         "@uf_cbd_amt", model.CBDAmount,
         "@uf_last_forecast", model.UfLastForecast,
         "@uf_budget_remain", model.UfBudgetRemain,
         "@uf_budget_org", model.MP1Amount,
         "@uf_proj_reason", model.UfProjectReason,
         "@last_update_date", model.LastUpdateDate,
         "@last_updated_by", model.LastUpdateBy,
         "@creation_date", model.CreationDate,
         "@created_by", model.CreatedBy,
         "@excess_cost", model.ExcessCost,
         "@remarks", model.Remarks,
         "@bg_cost_usaged", model.BeginCostUsaged,
         "@bg_cost_actual", model.BeginCostActual,
         "@bg_cost_usagedinstock", model.BeginCostUsagedInstock,
         "@instock_cost_amt", model.InstockCostAmount
     });
 }
Exemple #5
0
        public int Insert(ProjectCostModel model)
        {
            string sql =
                @"INSERT INTO prj_project_costs
                       ( line_num, project_id
                        , project_num, cost_id, cost_code
                        , orig_amt, plan_cost, fcst_cost
                        , act_cost, uf_ctg_amt, uf_cbd_amt
                        , uf_last_forecast, uf_budget_remain, uf_budget_org
                        , uf_proj_reason, last_update_date, last_updated_by
                        , creation_date, created_by
                        , excess_cost, remarks, instock_cost_amt
                        , bg_cost_usaged, bg_cost_actual, bg_cost_usagedinstock)
                    VALUES
                        ( @line_num, @project_id
                        , @project_num, @cost_id, @cost_code
                        , @orig_amt, @plan_cost, @fcst_cost
                        , @act_cost, @uf_ctg_amt, @uf_cbd_amt
                        , @uf_last_forecast, @uf_budget_remain, @uf_budget_org
                        , @uf_proj_reason, @last_update_date, @last_updated_by
                        , @creation_date, @created_by
                        , @excess_cost, @remarks, @instock_cost_amt
                        , @bg_cost_usaged, @bg_cost_actual, @bg_cost_usagedinstock)";

            return(db.Insert(sql, Take(model)));
        }
Exemple #6
0
        public void Update(ProjectCostModel model)
        {
            string sql =
                @"UPDATE  prj_project_costs 
                   SET  line_num  = @line_num
                      , project_id  = @project_id
                      , project_num  = @project_num
                      , cost_id  = @cost_id
                      , cost_code  = @cost_code
                      , orig_amt  = @orig_amt
                      , plan_cost  = @plan_cost
                      , fcst_cost  = @fcst_cost
                      , act_cost  = @act_cost
                      , uf_ctg_amt  = @uf_ctg_amt
                      , uf_cbd_amt  = @uf_cbd_amt
                      , uf_last_forecast  = @uf_last_forecast
                      , uf_budget_remain  = @uf_budget_remain
                      , uf_budget_org  = @uf_budget_org
                      , uf_proj_reason  = @uf_proj_reason
                      , last_update_date  = @last_update_date
                      , last_updated_by  = @last_updated_by
                      , excess_cost = @excess_cost
                      , remarks = @remarks
                      , bg_cost_usaged = @bg_cost_usaged
                      , bg_cost_actual = @bg_cost_actual
                      , bg_cost_usagedinstock = @bg_cost_usagedinstock
                      , instock_cost_amt= @instock_cost_amt
                 WHERE proj_cost_id = @proj_cost_id";

            db.Update(sql, Take(model));
        }
Exemple #7
0
        public int Update(ProjectCostModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new ProjectCostBLL().Update(ObjModel, transaction);
                        transaction.Commit();
                    }
                    catch (Exception exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Exemple #8
0
 private void Initialize(SqlDataReader reader, ProjectCostModel obj)
 {
     try
     {
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "ProjectCostCode")) != DBNull.Value)
         {
             obj.ProjectCostCode = reader.GetInt32(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "ProjectCostCode"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "ProjectName")) != DBNull.Value)
         {
             obj.ProjectName = reader.GetString(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "ProjectName"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "GroupCode")) != DBNull.Value)
         {
             obj.GroupCode = reader.GetString(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "GroupCode"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Area")) != DBNull.Value)
         {
             obj.Area = reader.GetDecimal(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Area"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Price")) != DBNull.Value)
         {
             obj.Price = reader.GetDecimal(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Price"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Money")) != DBNull.Value)
         {
             obj.Money = reader.GetDecimal(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Money"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Qty")) != DBNull.Value)
         {
             obj.Qty = reader.GetDecimal(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Qty"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Unit")) != DBNull.Value)
         {
             obj.Unit = reader.GetString(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Unit"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "InputPerson")) != DBNull.Value)
         {
             obj.InputPerson = reader.GetString(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "InputPerson"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "InputDate")) != DBNull.Value)
         {
             obj.InputDate = reader.GetDateTime(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "InputDate"));
         }
         if (reader.GetValue(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Remark")) != DBNull.Value)
         {
             obj.Remark = reader.GetString(SqlDataProcess.GetSqlDataReaderFieldIndex(reader, "Remark"));
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #9
0
        public int Delete(ProjectCostModel mObj)
        {
            int num;

            try
            {
                num = this._Delete(mObj.ProjectCostCode);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }
Exemple #10
0
        public int Delete(ProjectCostModel ObjModel, SqlTransaction Transaction)
        {
            int num;

            try
            {
                num = this.Delete(ObjModel.ProjectCostCode, Transaction);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }
Exemple #11
0
        public int Update(ProjectCostModel mObj)
        {
            int num;

            try
            {
                num = this._Update(mObj);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }
Exemple #12
0
        public int Update(ProjectCostModel ObjModel, SqlTransaction Transaction)
        {
            int num;

            try
            {
                ProjectCostDAL tdal = new ProjectCostDAL(Transaction);
                ObjModel.InputDate = DateTime.Now;
                num = tdal.Update(ObjModel);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }
Exemple #13
0
        private ProjectCostModel _DataBind(int Code)
        {
            Exception        exception;
            ProjectCostModel model2;

            try
            {
                ProjectCostModel model   = new ProjectCostModel();
                StringBuilder    builder = new StringBuilder();
                builder.Append("select * from ProjectCost");
                builder.Append(" where ProjectCostCode=@ProjectCostCode");
                this._DataProcess.CommandText = builder.ToString();
                this._DataProcess.ProcessParametersAdd("@ProjectCostCode", SqlDbType.Int, 4, Code);
                SqlDataReader sqlDataReader = null;
                try
                {
                    try
                    {
                        sqlDataReader = this._DataProcess.GetSqlDataReader();
                        while (sqlDataReader.Read())
                        {
                            this.Initialize(sqlDataReader, model);
                        }
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        throw exception;
                    }
                }
                finally
                {
                    if (sqlDataReader != null)
                    {
                        sqlDataReader.Close();
                    }
                }
                model2 = model;
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
            return(model2);
        }
Exemple #14
0
        private void GetLine_Selected(object sender, EventArgs e)
        {
            MetroGrid grd = sender as MetroGrid;

            ProjectCostModel line = new ProjectCostModel();

            try
            {
                line = (ProjectCostModel)grd.CurrentRow.DataBoundItem;
            }
            catch
            {
                //MessageBox.Show(ex.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                line = null;
            }

            _view.costSelected = line;
        }
        private void CostCode_Change(object sender, EventArgs e)
        {
            ComboBox cbo      = sender as ComboBox;
            string   costCode = cbo.Text;

            if (!string.IsNullOrEmpty(costCode))
            {
                ProjectCostModel cost = _view.costs.Where(x => x.CostCode == costCode).FirstOrDefault();
                if (cost == null)
                {
                    _view.forCostCode = string.Empty;
                    _view.costs       = new List <ProjectCostModel>();
                    _view.BindingComboProjectsCost(_view.costs.ToList());
                    return;
                }
            }
            else
            {
                costCode = string.Empty;
            }

            _view.forCostCode = costCode;
        }
Exemple #16
0
 private string ImportSingle(string val)
 {
     try
     {
         string[] arr = ImportRule.SplitCsvLine(val);
         if (arr.Length < base.MinColCount)
         {
             return(string.Format("列不足{0}个", base.MinColCount));
         }
         string text = arr[0].Trim();
         if (text == "")
         {
             return("项目名称为空");
         }
         string text2 = arr[1].Trim();
         string text3 = "";
         if (text2 != "")
         {
             DataRow[] rowArray = this.m_tbSystemGroup.Select("FullName = '" + text2 + "'");
             if (rowArray.Length > 0)
             {
                 text3 = rowArray[0]["GroupCode"].ToString();
             }
         }
         if (text3 == "")
         {
             return(string.Format("未知的费用项“{0}”", text2));
         }
         ProjectCostDAL   tdal = new ProjectCostDAL(this.conn);
         ProjectCostModel mObj = new ProjectCostModel();
         mObj.ProjectCostCode = int.Parse(SystemManageDAO.GetNewSysCode("ProjectCostCode"));
         mObj.ProjectName     = text;
         mObj.GroupCode       = text3;
         mObj.Unit            = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 3)).Trim();
         mObj.InputPerson     = this.InputPerson;
         try
         {
             if (ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 2)).Trim() == "")
             {
                 mObj.Area = 0M;
             }
             else
             {
                 mObj.Area = decimal.Parse(ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 2)).Trim());
             }
         }
         catch
         {
             return(string.Format("面积“{0}”不是有效的数值", ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 2)).Trim()));
         }
         try
         {
             if (ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 3)).Trim() == "")
             {
                 mObj.Price = 0M;
             }
             else
             {
                 mObj.Price = decimal.Parse(ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 3)).Trim());
             }
         }
         catch
         {
             return(string.Format("单方造价“{0}”不是有效的数值", ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 3)).Trim()));
         }
         try
         {
             if (ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 4)).Trim() == "")
             {
                 mObj.Money = 0M;
             }
             else
             {
                 mObj.Money = decimal.Parse(ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 4)).Trim());
             }
         }
         catch
         {
             return(string.Format("总价“{0}”不是有效的数值", ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 4)).Trim()));
         }
         try
         {
             if (ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 5)).Trim() == "")
             {
                 mObj.Qty = 0M;
             }
             else
             {
                 mObj.Qty = decimal.Parse(ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 5)).Trim());
             }
         }
         catch
         {
             return(string.Format("数量“{0}”不是有效的数值", ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 5)).Trim()));
         }
         if (((mObj.Money == 0M) && (mObj.Price != 0M)) && (mObj.Area != 0M))
         {
             mObj.Money = Math.Round((decimal)(mObj.Price * mObj.Area), 2);
         }
         if (((mObj.Price == 0M) && (mObj.Money != 0M)) && (mObj.Area != 0M))
         {
             mObj.Price = Math.Round((decimal)(mObj.Money / mObj.Area), 2);
         }
         mObj.Remark = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 5)).Trim();
         tdal.Insert(mObj);
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return("");
 }
Exemple #17
0
 public int InsertProjCost(ProjectCostModel model)
 {
     return(factory.ProjectCostDao.Insert(model));
 }
Exemple #18
0
 public void UpdateProjCost(ProjectCostModel model)
 {
     model.LastUpdateDate = DateTime.Now;
     factory.ProjectCostDao.Update(model);
 }
Exemple #19
0
        private int _Update(ProjectCostModel mObj)
        {
            int num;

            try
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("update ProjectCost set ");
                if (mObj.ProjectName != null)
                {
                    builder.Append("ProjectName=@ProjectName,");
                    this._DataProcess.ProcessParametersAdd("@ProjectName", SqlDbType.VarChar, 100, mObj.ProjectName);
                }
                if (mObj.GroupCode != null)
                {
                    builder.Append("GroupCode=@GroupCode,");
                    this._DataProcess.ProcessParametersAdd("@GroupCode", SqlDbType.VarChar, 50, mObj.GroupCode);
                }
                if (mObj.Area != 0M)
                {
                    builder.Append("Area=@Area,");
                    this._DataProcess.ProcessParametersAdd("@Area", SqlDbType.Decimal, 9, mObj.Area);
                }
                if (mObj.Price != 0M)
                {
                    builder.Append("Price=@Price,");
                    this._DataProcess.ProcessParametersAdd("@Price", SqlDbType.Decimal, 9, mObj.Price);
                }
                if (mObj.Money != 0M)
                {
                    builder.Append("Money=@Money,");
                    this._DataProcess.ProcessParametersAdd("@Money", SqlDbType.Decimal, 9, mObj.Money);
                }
                if (mObj.Qty != 0M)
                {
                    builder.Append("Qty=@Qty,");
                    this._DataProcess.ProcessParametersAdd("@Qty", SqlDbType.Decimal, 9, mObj.Qty);
                }
                if (mObj.Unit != null)
                {
                    builder.Append("Unit=@Unit,");
                    this._DataProcess.ProcessParametersAdd("@Unit", SqlDbType.VarChar, 50, mObj.Unit);
                }
                if (mObj.InputPerson != null)
                {
                    builder.Append("InputPerson=@InputPerson,");
                    this._DataProcess.ProcessParametersAdd("@InputPerson", SqlDbType.VarChar, 50, mObj.InputPerson);
                }
                if (mObj.InputDate != DateTime.MinValue)
                {
                    builder.Append("InputDate=@InputDate,");
                    this._DataProcess.ProcessParametersAdd("@InputDate", SqlDbType.DateTime, 8, mObj.InputDate);
                }
                if (mObj.Remark != null)
                {
                    builder.Append("Remark=@Remark,");
                    this._DataProcess.ProcessParametersAdd("@Remark", SqlDbType.VarChar, 800, mObj.Remark);
                }
                builder.Remove(builder.Length - 1, 1);
                builder.Append(" where ProjectCostCode=@ProjectCostCode");
                this._DataProcess.ProcessParametersAdd("@ProjectCostCode", SqlDbType.Int, 4, mObj.ProjectCostCode);
                this._DataProcess.CommandText = builder.ToString();
                num = this._DataProcess.RunSql();
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }
Exemple #20
0
        private List <ProjectCostModel> _Select(ProjectCostQueryModel qmObj)
        {
            Exception exception;
            List <ProjectCostModel> list2;

            try
            {
                List <ProjectCostModel> list    = new List <ProjectCostModel>();
                StringBuilder           builder = new StringBuilder();
                builder.Append("select * from ProjectCost ");
                builder.Append(qmObj.QueryConditionStr);
                if ((qmObj.SortColumns == null) || (qmObj.SortColumns.Length == 0))
                {
                    builder.Append(" ORDER BY ProjectCostCode 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)))
                            {
                                ProjectCostModel model = new ProjectCostModel();
                                this.Initialize(sqlDataReader, model);
                                list.Add(model);
                            }
                            num++;
                        }
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        throw exception;
                    }
                }
                finally
                {
                    if (sqlDataReader != null)
                    {
                        sqlDataReader.Close();
                    }
                }
                list2 = list;
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
            return(list2);
        }
Exemple #21
0
        private void Paste_Rows(object sender, EventArgs e)
        {
            if (_view.projectSelected != null)
            {
                DataObject o = (DataObject)Clipboard.GetDataObject();
                if (o.GetDataPresent(DataFormats.Text))
                {
                    List <ProjectCostModel> costs = _view.projectCosts;

                    string[] pastedRows = Regex.Split(o.GetData(DataFormats.Text).ToString().TrimEnd("\r\n".ToCharArray()), "\r\n");
                    foreach (string pastedRow in pastedRows)
                    {
                        ProjectCostModel cost           = new ProjectCostModel();
                        string[]         pastedRowCells = pastedRow.Split(new char[] { '\t' });
                        bool             valid          = true;
                        for (int i = 0; i < pastedRowCells.Length; i++)
                        {
                            if (i == 0)
                            {
                                cost.CostCode = pastedRowCells[i];
                                int id = ValidCostGroup(cost.CostCode);
                                cost.CostId = id;
                                if (id == 0)
                                {
                                    MessageBox.Show("Cost Code : " + cost.CostCode + " dose not existing.", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    valid = false;
                                }
                                if (DuplicateCostCode(cost.CostCode))
                                {
                                    MessageBox.Show("Cost Code : " + cost.CostCode + " is dupplicated.", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    valid = false;
                                }
                            }

                            if (i == 1)
                            {
                                cost.CostDescription = pastedRowCells[i];
                            }

                            if (i == 2)
                            {
                                cost.CBDAmount = InvalidNumber(string.IsNullOrEmpty(pastedRowCells[i]) ? "0" : pastedRowCells[i]);
                            }

                            if (i == 3)
                            {
                                cost.CTGAmount = InvalidNumber(string.IsNullOrEmpty(pastedRowCells[i]) ? "0" : pastedRowCells[i]);
                            }

                            if (i == 4)
                            {
                                cost.MP1Amount = InvalidNumber(string.IsNullOrEmpty(pastedRowCells[i]) ? "0" : pastedRowCells[i]);
                            }

                            if (i == 5)
                            {
                                cost.BudgetCostAmount = InvalidNumber(string.IsNullOrEmpty(pastedRowCells[i]) ? "0" : pastedRowCells[i]);
                            }

                            cost.ProjectId = _view.projectSelected.Id;
                        }
                        if (valid)
                        {
                            costs.Add(cost);
                        }
                    }
                    _view.projectCosts = costs;
                    Save_Click(null, null);
                }
            }
            else
            {
                MessageBox.Show("Project is null! please select Project.", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }