Exemplo n.º 1
0
        //UPDATE
        public bool UpdateCCGM(eSunSpeedDomain.CostCentreGroupModel objCCG)
        {
            string Query     = string.Empty;
            bool   isUpdated = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@GroupName", objCCG.GroupName));
                paramCollection.Add(new DBParameter("@Alias", objCCG.Alias));
                paramCollection.Add(new DBParameter("@PrimaryGroup", objCCG.PrimaryGroup, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@underGroup", objCCG.underGroup));
                paramCollection.Add(new DBParameter("@ModifiedBy", objCCG.ModifiedBy));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@CCG_ID", objCCG.CCG_ID));

                Query = "UPDATE CostCentreGroupMaster SET GroupName=@GroupName,Alias=@Alias,`PrimaryGroup`=@PrimaryGroup,underGroup=@underGroup,ModifiedBy=@ModifiedBy,ModifiedDate=@ModifiedDate " +
                        "WHERE CCG_ID=@CCG_ID";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isUpdated = true;
                }
            }
            catch (Exception ex)
            {
                isUpdated = false;
                throw ex;
            }

            return(isUpdated);
        }
Exemplo n.º 2
0
        //Save

        public bool SaveCCG(eSunSpeedDomain.CostCentreGroupModel ObjCCG)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@GroupName", ObjCCG.GroupName));
                paramCollection.Add(new DBParameter("@Alias", ObjCCG.Alias));
                paramCollection.Add(new DBParameter("@PrimaryGroup", ObjCCG.PrimaryGroup, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@underGroup", ObjCCG.underGroup));
                paramCollection.Add(new DBParameter("@CreatedBy", ObjCCG.CreatedBy));
                paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, System.Data.DbType.DateTime));

                Query = "INSERT INTO CostCentreGroupMaster(`GroupName`,`Alias`,`PrimaryGroup`,`underGroup`,`CreatedBy`,`CreatedDate`)" +

                        "VALUES(@GroupName,@Alias,@PrimaryGroup,@underGroup,@CreatedBy,@CreatedDate)";


                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isSaved = true;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }