Exemple #1
0
        protected static void AddTotalIndirect(List <OrganizationBudget> indirectBudgets)
        {
            OrganizationBudget item = new OrganizationBudget {
                Id            = Guid.NewGuid().ToString(),
                CBSCode       = "001002",
                AccountAmount = 0M,
                BudgetAmount  = 0M,
                State         = "2"
            };

            indirectBudgets.Insert(0, item);
        }
Exemple #2
0
 private void AddToOrganBudget(string cbsCode, string inputUser)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         foreach (System.Linq.IGrouping <string, string> grouping in (from m in entities.Bud_OrganizationBudget
                                                                      select m.OrganizationBudgetId into id
                                                                      group id by id).ToList <System.Linq.IGrouping <string, string> >())
         {
             string             key         = grouping.Key;
             OrganizationBudget organBudget = OrganizationBudget.Create(Guid.NewGuid().ToString(), key, cbsCode, 0M, 0M, inputUser, DateTime.Now, string.Empty);
             organBudget.Add(organBudget);
         }
     }
 }
Exemple #3
0
 public void Update(OrganizationBudget organBudget)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         Bud_OrganizationBudget budget = (from m in entities.Bud_OrganizationBudget
                                          where (m.OrganizationBudgetId == organBudget.OrganizationBudgetId) && (m.CBSCode == organBudget.CBSCode)
                                          select m).FirstOrDefault <Bud_OrganizationBudget>();
         if (budget == null)
         {
             throw new Exception("此项目的间接成本预算不存在!");
         }
         budget.BudgetAmount     = new decimal?(organBudget.BudgetAmount);
         budget.AccountingAmount = new decimal?(organBudget.AccountAmount);
         budget.State            = organBudget.State;
         entities.SaveChanges();
     }
 }
Exemple #4
0
 public void Add(OrganizationBudget organBudget)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         Bud_OrganizationBudget budget = new Bud_OrganizationBudget {
             Id                   = organBudget.Id,
             BudgetAmount         = new decimal?(organBudget.BudgetAmount),
             AccountingAmount     = new decimal?(organBudget.AccountAmount),
             CBSCode              = organBudget.CBSCode,
             OrganizationBudgetId = organBudget.OrganizationBudgetId,
             State                = organBudget.State,
             Note                 = organBudget.Note,
             InputUser            = organBudget.InputUser,
             InputDate            = this.InputDate
         };
         entities.AddToBud_OrganizationBudget(budget);
         entities.SaveChanges();
     }
 }
Exemple #5
0
        public static OrganizationBudget GetByOrganAndCBSCode(string organizationBudgetId, string cbsCode)
        {
            OrganizationBudget organBudget = null;

            using (pm2Entities context = new pm2Entities())
            {
                organBudget = (
                    from m in context.Bud_OrganizationBudget
                    where m.OrganizationBudgetId == organizationBudgetId && m.CBSCode == cbsCode
                    select new OrganizationBudget
                {
                    State = m.State,
                    AccountAmount = m.AccountingAmount ?? 0m,
                    CBSCode = m.CBSCode,
                    OrganizationBudgetId = m.OrganizationBudgetId,
                    BudgetAmount = m.BudgetAmount ?? 0m
                }).FirstOrDefault <OrganizationBudget>();
            }
            return(organBudget);
        }
Exemple #6
0
        public static OrganizationBudget GetById(string id)
        {
            OrganizationBudget organBudget = null;

            using (pm2Entities context = new pm2Entities())
            {
                organBudget = (
                    from m in context.Bud_OrganizationBudget
                    where m.Id == id
                    select new OrganizationBudget
                {
                    Id = m.Id,
                    State = m.State,
                    InputDate = m.InputDate,
                    AccountAmount = m.AccountingAmount ?? 0m,
                    CBSCode = m.CBSCode,
                    OrganizationBudgetId = m.OrganizationBudgetId,
                    BudgetAmount = m.BudgetAmount ?? 0m
                }).FirstOrDefault <OrganizationBudget>();
            }
            return(organBudget);
        }
Exemple #7
0
 public static System.Collections.Generic.List <OrganizationBudget> GetAllPass(string organizationBudgetId)
 {
     System.Collections.Generic.List <OrganizationBudget> organBudgets = new System.Collections.Generic.List <OrganizationBudget>();
     using (pm2Entities context = new pm2Entities())
     {
         organBudgets = (
             from m in context.Bud_OrganizationBudget
             where m.OrganizationBudgetId == organizationBudgetId && m.State == "2"
             orderby m.CBSCode
             select new OrganizationBudget
         {
             Id = m.Id,
             AccountAmount = (decimal)m.AccountingAmount,
             BudgetAmount = (decimal)m.BudgetAmount,
             CBSCode = m.CBSCode
         }).ToList <OrganizationBudget>();
         if (organBudgets.Count > 0)
         {
             OrganizationBudget.AddTotalIndirect(organBudgets);
         }
     }
     return(organBudgets);
 }
Exemple #8
0
        protected bool IsDelAll(List <string> ids)
        {
            bool flag = true;

            using (pm2Entities entities = new pm2Entities())
            {
                using (List <string> .Enumerator enumerator = ids.GetEnumerator())
                {
                    string id;
                    while (enumerator.MoveNext())
                    {
                        id = enumerator.Current;
                        Bud_CostAccounting accounting = (from m in entities.Bud_CostAccounting
                                                         where (m.Id == id) && (m.CBSCode.Length >= 6)
                                                         select m).FirstOrDefault <Bud_CostAccounting>();
                        if (accounting != null)
                        {
                            bool   flag2   = true;
                            string cBSCode = accounting.CBSCode;
                            if (accounting.Type == "D")
                            {
                                flag2 = ConstructResource.IsExistCBSCode(cBSCode);
                            }
                            else
                            {
                                flag2 = IndirectBudget.IsExistCBSCode(cBSCode) || OrganizationBudget.IsExistCBSCode(cBSCode);
                            }
                            if (flag2)
                            {
                                return(false);
                            }
                        }
                    }
                    return(flag);
                }
            }
        }
Exemple #9
0
        public static void AddOrDelDesktopNotifications(string id, bool isEReport)
        {
            string zzjgName = OrganizationBudget.GetZZJGName(id);

            System.Text.StringBuilder sqlYHMC = new System.Text.StringBuilder();
            sqlYHMC.Append("SELECT v_yhdm FROM PT_yhmc");
            sqlYHMC.AppendLine();
            sqlYHMC.AppendFormat("WHERE i_bmdm='{0}' AND State='1' AND c_sfyx='y'", id);
            SqlDataReader sdrYHBM   = SqlHelper.ExecuteReader(CommandType.Text, sqlYHMC.ToString(), new SqlParameter[0]);
            PTDbsjBll     pTDbsjBll = new PTDbsjBll();

            pTDbsjBll.DelPastDueData(id);
            while (sdrYHBM.Read())
            {
                if (isEReport)
                {
                    string people = sdrYHBM["v_yhdm"].ToString();
                    if (people != "")
                    {
                        System.Text.StringBuilder content = new System.Text.StringBuilder();
                        content.Append("组织机构:" + zzjgName);
                        content.Append("的间接成本预算已经上报,请审核!");
                        pTDbsjBll.Add(new PTDbsjModel
                        {
                            C_OpenFlag = "0",
                            DTM_DBSJ   = System.DateTime.Now,
                            I_XGID     = id,
                            V_Content  = content.ToString(),
                            V_DBLJ     = "BudgetManage/Cost/IndirectBudgetQuery.aspx?id=" + id,
                            V_LXBM     = "021",
                            V_TPLJ     = "new_Mail.gif",
                            V_YHDM     = people
                        });
                    }
                }
            }
        }
Exemple #10
0
        public static bool Del(List <string> ids)
        {
            bool           flag       = false;
            CostAccounting accounting = new CostAccounting();

            if (accounting.IsDelAll(ids))
            {
                using (pm2Entities entities = new pm2Entities())
                {
                    using (List <string> .Enumerator enumerator = ids.GetEnumerator())
                    {
                        string id;
                        while (enumerator.MoveNext())
                        {
                            id = enumerator.Current;
                            Bud_CostAccounting entity = (from m in entities.Bud_CostAccounting
                                                         where (m.Id == id) && (m.CBSCode.Length >= 6)
                                                         select m).FirstOrDefault <Bud_CostAccounting>();
                            if (entity != null)
                            {
                                bool   flag3   = true;
                                string cBSCode = entity.CBSCode;
                                if (entity.Type == "D")
                                {
                                    flag3 = ConstructResource.IsExistCBSCode(cBSCode);
                                }
                                else
                                {
                                    flag3 = IndirectBudget.IsExistCBSCode(cBSCode) || OrganizationBudget.IsExistCBSCode(cBSCode);
                                }
                                if (!flag3)
                                {
                                    entities.DeleteObject(entity);
                                    entities.SaveChanges();
                                    flag = true;
                                }
                            }
                        }
                    }
                }
            }
            return(flag);
        }