Exemplo n.º 1
0
        public WorkEntity Read(int agreementID)
        {
            Parameters = new List<SqlParameter>();

            Parameters.Add(new SqlParameter("@AgreementTypeID", agreementID));
            WorkEntity entity = null;
            SqlDataReader reader = null;
            try
            {
                Parameters.Add(new SqlParameter("@Action", "R"));
                reader = ExecDataReader(DBCommands.WorkTable);
                if (reader.Read())
                {
                    entity = new WorkEntity();
                    entity.WorkID =reader["WorkID"].ToInt32();
                    entity.GovernmentMarketingServices = reader["GovernmentMarketingServices"].ToStr();
                    entity.Lobbying = reader["Lobbying"].ToStr();
                    entity.NonEmpSalesRepresentation = reader["NonEmpSalesRepresentation"].ToStr();
                    entity.ServiceDescription = reader["ServiceDescription"].ToStr();
                    entity.ServicesProvided = reader["ServicesProvided"].ToStr();
                    entity.QuoteDocName = reader["QuoteDocName"].ToStr();
                    entity.QuoteDocUniqueName = reader["QuoteDocUniqueName"].ToStr();
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }

            return entity;
        }
Exemplo n.º 2
0
        public int Insert(WorkEntity entity)
        {
            Parameters = new List<SqlParameter>();
            Parameters.Add(new SqlParameter("@WorkID", entity.WorkID));
            Parameters.Add(new SqlParameter("@AgreementTypeID", entity.AgreementTypeID));
            Parameters.Add(new SqlParameter("@ServicesProvided", entity.ServicesProvided));
            Parameters.Add(new SqlParameter("@ServiceDescription", entity.ServiceDescription));
            Parameters.Add(new SqlParameter("@GovernmentMarketingServices", entity.GovernmentMarketingServices));
            Parameters.Add(new SqlParameter("@Lobbying", entity.Lobbying));
            Parameters.Add(new SqlParameter("@NonEmpSalesRepresentation", entity.NonEmpSalesRepresentation));
            Parameters.Add(new SqlParameter("@QuoteDocUniqueName", entity.QuoteDocUniqueName));
            Parameters.Add(new SqlParameter("@QuoteDocName", entity.QuoteDocName));

            object id = null;
            if (entity.WorkID == 0)
            {
                Parameters.Add(new SqlParameter("@Action", "C"));
                id = ExecuteScalar(DBCommands.WorkTable);
            }
            else
            {
                Parameters.Add(new SqlParameter("@Action", "U"));
                ExecCommand(DBCommands.WorkTable);
                id = entity.WorkID;
            }
            return Convert.ToInt32(id);
        }
Exemplo n.º 3
0
 public int Insert(WorkEntity entity)
 {
     WorkDao workDao = new WorkDao();
     return workDao.Insert(entity);
 }
Exemplo n.º 4
0
        private int SaveData(string action)
        {
            WorkEntity entity = new WorkEntity();
            int agreementID = SessionManager.AgreementTypeID;
            entity.AgreementTypeID = agreementID;
            if (hdnWorkID.Value != string.Empty)
            {
                entity.WorkID = Convert.ToInt32(hdnWorkID.Value);

            }
            entity.ServicesProvided = rdoServicesProvided.SelectedValue;
            entity.GovernmentMarketingServices = rdoGovernmentMarketingServices.SelectedValue;
            entity.ServiceDescription = txtServiceDescription.Text.Trim();
            entity.Lobbying = rdoLobbying.SelectedValue;
            entity.NonEmpSalesRepresentation = rdoNonEmpSalesRepresentation.SelectedValue;

            bool isFileSaved = upload();
            //hdnWorkID.Value = Convert.ToString(entity.WorkID);

            string fileName = lblFileName.Text;
            string uniqueFileName = hdnFilePath.Value;
            entity.QuoteDocName = fileName;
            entity.QuoteDocUniqueName = uniqueFileName;

            //if (isFileSaved)
            //{
            if (SessionManager.AgreementType == "R" || fileName != string.Empty || action == "S")
            {
                WorkBI work = new WorkBI();
                int workID = work.Insert(entity);
                return workID;
            }

            //}
            return 0;
        }