Esempio n. 1
0
        public AddMaterialMasterResponseDto AddMaterialMaster(AddMaterialMasterRequestDto addMaterialMasterRequestDto)
        {
            AddMaterialMasterResponseDto addMaterialMasterResponseDto = new AddMaterialMasterResponseDto();

            var cModel = new AddMaterialMasterCM
            {
                MaterialDescription      = addMaterialMasterRequestDto.MaterialDescription,
                MaterialShortDescription = addMaterialMasterRequestDto.MaterialShortDescription
            };

            var response = materialMasterRepository.AddMaterialMaster(cModel);

            return(new AddMaterialMasterResponseDto());
        }
Esempio n. 2
0
        public AddMaterialMasterQM AddMaterialMaster(AddMaterialMasterCM addMaterialMasterCM)
        {
            var response = new AddMaterialMasterQM();

            using (var connection = new DbConnectionProvider().CreateConnection())
            {
                connection.Open();

                var command = new MaterialMasterInsertCommand {
                    Connection = connection
                };
                response.MaterialCode = command.Execute(addMaterialMasterCM);
            }

            return(response);
        }
        public int Execute(AddMaterialMasterCM model)
        {
            using (var sqlCommand = CreateCommand())
            {
                sqlCommand.Connection  = Connection;
                sqlCommand.CommandText = "[dbo].[uspAddMaterialMaster]";
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Parameters.Add(AddParameter("@MaterialDescription", SsDbType.VarChar, ParameterDirection.Input, model.MaterialDescription));
                sqlCommand.Parameters.Add(AddParameter("@MaterialShortDescription", SsDbType.VarChar, ParameterDirection.Input, model.MaterialShortDescription));

                //sqlCommand.Parameters.Add(AddParameter("@CreatedBy", SsDbType.UniqueIdentifier, ParameterDirection.Input, model.CreatedBy));
                //sqlCommand.Parameters.Add(AddParameter("@CreatedDateTime", SsDbType.DateTime, ParameterDirection.Input, model.CreatedDateTime));

                sqlCommand.Parameters.Add(AddParameter("@CreatedBy", SsDbType.UniqueIdentifier, ParameterDirection.Input, new Guid()));
                sqlCommand.Parameters.Add(AddParameter("@CreatedDateTime", SsDbType.DateTime, ParameterDirection.Input, DateTime.UtcNow));

                sqlCommand.Parameters.Add(AddParameter("@MaterialCode", SsDbType.Decimal, ParameterDirection.Output, default(int)));
                sqlCommand.ExecuteNonQuery();

                return(Convert.ToInt32(sqlCommand.Parameters["@MaterialCode"].Value));
            }
        }