Exemplo n.º 1
0
        public int UpdatePcises(string cicoid, string sYear, string atCode, FormCViewmodel formCViewmodel)
        {
            var varPcis = formCViewmodel.Pcises;
            var retVal  = 0;

            foreach (var pc in varPcis)
            {
                switch (pc.Entity)
                {
                case null:
                    pc.PcisUpdType = 2;
                    break;
                }
                if (pc.PcisId == 0 || pc.Entity == null)
                {
                }
                else
                {
                    if (pc.Entity != null && (pc.PcisId > 0 && pc.Entity.Trim() != ""))
                    {
                        pc.PcisUpdType = 1;
                    }
                    else if (pc.Entity != null && (pc.PcisId > 0 && pc.Entity.Trim() == ""))
                    {
                        pc.PcisUpdType = 2;
                    }
                    else
                    {
                        pc.PcisUpdType = 0;
                    }
                }
                try
                {
                    _hmEntities.UpdatePcis(cicoid, sYear, atCode, pc.PcisId, pc.Entity, pc.EntityProject, pc.PromotionItems, pc.ExpenditureAmount, Convert.ToByte(pc.PcisUpdType));
                    retVal = 1;
                }
                catch (Exception)
                {
                    retVal = 0;
                    throw;
                }
            }
            return(retVal);
        }
Exemplo n.º 2
0
        public int UpdateProjects(string cicoid, string sYear, string atCode, FormCViewmodel formCViewmodel)
        {
            var varProjects = formCViewmodel.Projects;
            var retVal      = 0;

            foreach (var proj in varProjects)
            {
                switch (proj.ProjectDescription)
                {
                case null:
                    proj.ProjectUpdType = 2;
                    break;
                }
                if (proj.ProjectId == 0 || proj.ProjectDescription == null)
                {
                }
                else
                {
                    if (proj.ProjectDescription != null && (proj.ProjectId > 0 && proj.ProjectDescription.Trim() != ""))
                    {
                        proj.ProjectUpdType = 1;
                    }
                    else if (proj.ProjectDescription != null && (proj.ProjectId > 0 && proj.ProjectDescription.Trim() == ""))
                    {
                        proj.ProjectUpdType = 2;
                    }
                    else
                    {
                        proj.ProjectUpdType = 0;
                    }
                }
                try
                {
                    _hmEntities.UpdateProjects(cicoid, sYear, atCode, proj.ProjectId, proj.ProjectDescription, proj.ProjectStatus, Convert.ToByte(proj.ProjectUpdType));
                    retVal = 1;
                }
                catch (Exception)
                {
                    retVal = 0;
                    throw;
                }
            }
            return(retVal);
        }