Beispiel #1
0
        public List <ProjectCostModel> GetModels(SqlTransaction Transaction)
        {
            List <ProjectCostModel> list;

            try
            {
                list = new ProjectCostDAL(Transaction).Select();
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(list);
        }
Beispiel #2
0
        public ProjectCostModel GetModel(int Code, SqlTransaction Transaction)
        {
            ProjectCostModel model;

            try
            {
                model = new ProjectCostDAL(Transaction).GetModel(Code);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(model);
        }
Beispiel #3
0
        public List <ProjectCostModel> GetModels(ProjectCostQueryModel ObjQueryModel, SqlConnection Connection)
        {
            List <ProjectCostModel> list;

            try
            {
                list = new ProjectCostDAL(Connection).Select(ObjQueryModel);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(list);
        }
Beispiel #4
0
        public int Delete(int Code, SqlTransaction Transaction)
        {
            int num;

            try
            {
                num = new ProjectCostDAL(Transaction).Delete(Code);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num);
        }
Beispiel #5
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);
        }
Beispiel #6
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("");
 }